快捷方式

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 的模式参数 (默认: "replicate")

返回

形状为 (…, freq, time) 的 delta 张量

返回类型

张量

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

文档

访问全面的 PyTorch 开发者文档

查看文档

教程

为初学者和高级开发者提供深入的教程

查看教程

资源

查找开发资源并让您的问题得到解答

查看资源