快捷鍵

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) – 音訊張量,維度為 (…, freq, time)

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

  • mode (str, optional) – 傳遞給 padding 的 mode 參數 (預設值:"replicate")

返回:

delta 張量,維度為 (…, freq, time)

返回類型:

Tensor

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

文件

存取 PyTorch 的完整開發者文件

查看文件

教學

取得初學者和進階開發者的深入教學

查看教學

資源

尋找開發資源並獲得問題解答

查看資源