快捷方式

torchaudio.functional.compute_deltas

torchaudio.functional.compute_deltas(specgram: Tensor, win_length: int = 5, mode: str = 'replicate') Tensor[原始碼]

計算張量的 delta 係數,通常用於頻譜圖

This feature supports the following devices: CPU, CUDA This API supports the following properties: TorchScript
\[d_t = \frac{\sum_{n=1}^{\text{N}} n (c_{t+n} - c_{t-n})}{2 \sum_{n=1}^{\text{N}} n^2} \]

其中 \(d_t\) 是時間 \(t\) 處的 delta,\(c_t\) 是時間 \(t\) 處的頻譜圖係數,\(N\)(win_length-1)//2

引數:
  • specgram (Tensor) – 維度為 (…, 頻率, 時間) 的音訊張量

  • win_length (int, 可選) – 用於計算 delta 的視窗長度(預設值:5

  • mode (str, 可選) – 傳遞給填充方法的模式引數(預設值:"replicate"

返回:

維度為 (…, 頻率, 時間) 的 delta 張量

返回型別:

Tensor

示例
>>> specgram = torch.randn(1, 40, 1000)
>>> delta = compute_deltas(specgram)
>>> delta2 = compute_deltas(delta)

文件

查閱 PyTorch 的完整開發者文件

檢視文件

教程

獲取適合初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源