Shortcuts

torch.blackman_window

torch.blackman_window(window_length, periodic=True, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) 张量

布莱克曼窗函数。

w[n]=0.420.5cos(2πnN1)+0.08cos(4πnN1)w[n] = 0.42 - 0.5 \cos \left( \frac{2 \pi n}{N - 1} \right) + 0.08 \cos \left( \frac{4 \pi n}{N - 1} \right)

其中 NN 是完整窗口大小。

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

注意

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

Parameters
  • window_length (int) – 返回窗口的大小

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

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

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

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

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

Returns

一个大小为 (window_length,)(\text{window\_length},) 的一维张量,包含窗口

Return type

张量