• 文档 >
  • torch >
  • torch.bartlett_window
快捷键

torch.bartlett_window

torch.bartlett_window(window_length, periodic=True, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) Tensor

巴特利特窗函数。

w[n]=12nN11={2nN1if 0nN1222nN1if N12<n<N,w[n] = 1 - \left| \frac{2n}{N-1} - 1 \right| = \begin{cases} \frac{2n}{N - 1} & \text{if } 0 \leq n \leq \frac{N - 1}{2} \\ 2 - \frac{2n}{N - 1} & \text{if } \frac{N - 1}{2} < n < N \\ \end{cases},

NN 表示完整窗口大小。

输入 window_length 是一个控制返回窗口大小的正整数。 periodic 标志决定返回的窗口是否修剪掉对称窗口的最后一个重复值,以便作为具有 torch.stft() 等功能的周期性窗口使用。因此,如果 periodic 为真,上述公式中的 NN 实际上是 window_length+1\text{window\_length} + 1 。此外,我们始终有 torch.bartlett_window(L, periodic=True) 等于 torch.bartlett_window(L + 1, periodic=False)[:-1])

注意

如果 window_length =1=1 ,则返回的窗口包含单个值 1。

参数:
  • window_length(整型)- 返回窗口的大小

  • periodic (bool, 可选) – 如果为 True,则返回用作周期函数的窗口。如果为 False,则返回对称窗口。

关键字参数:
  • dtype ( torch.dtype , 可选) – 返回张量的期望数据类型。默认:如果 None ,则使用全局默认值(见 torch.set_default_dtype() )。仅支持浮点类型。

  • layout ( torch.layout , 可选) – 返回窗口张量的期望布局。仅支持 torch.strided (密集布局)。

  • device ( torch.device ,可选) – 返回张量的期望设备。默认:如果 None ,则使用当前设备用于默认张量类型(见 torch.set_default_device() )。 device 将是 CPU 张量类型的 CPU 和 CUDA 张量类型的当前 CUDA 设备。

  • requires_grad (bool,可选) – 如果 autograd 应记录对返回张量的操作。默认: False

返回值:

包含窗口的 1-D 张量,大小为 (window_length,)(\text{window\_length},)

返回类型:

张量


© 版权所有 PyTorch 贡献者。

使用 Sphinx 构建,主题由 Read the Docs 提供。

文档

PyTorch 的全面开发者文档

查看文档

教程

深入了解初学者和高级开发者的教程

查看教程

资源

查找开发资源并获得您的疑问解答

查看资源