评价此页

torch.kaiser_window#

torch.kaiser_window(window_length, periodic=True, beta=12.0, *, dtype=None, layout=torch.strided, device=None, requires_grad=False) Tensor#

Computes the Kaiser window with window length window_length and shape parameter beta.

Let I_0 be the zeroth order modified Bessel function of the first kind (see torch.i0()) and N = L - 1 if periodic is False and L if periodic is True, where L is the window_length. This function computes

outi=I0(β1(iN/2N/2)2)/I0(β)out_i = I_0 \left( \beta \sqrt{1 - \left( {\frac{i - N/2}{N/2}} \right) ^2 } \right) / I_0( \beta )

调用 torch.kaiser_window(L, B, periodic=True) 等价于调用 torch.kaiser_window(L + 1, B, periodic=False)[:-1])periodic 参数旨在作为一种便捷的速记方法,用于为 torch.stft() 等函数提供周期性窗口作为输入。

注意

如果 window_length 为一,则返回的窗口是包含一的单个元素张量。

参数
  • window_length (int) – 窗口的长度。

  • periodic (bool, optional) – 如果为 True,则返回适用于频谱分析的周期性窗口。如果为 False,则返回适用于滤波器设计的对称窗口。

  • beta (float, optional) – 窗口的形状参数。

关键字参数
  • dtype (torch.dtype, optional) – 返回张量的所需数据类型。默认值:如果 None,则使用全局默认值(请参阅 torch.set_default_dtype())。

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

  • device (torch.device, optional) – 返回张量的所需设备。默认值:如果 None,则使用当前设备作为默认张量类型(请参阅 torch.set_default_device())。对于 CPU 张量类型,device 将是 CPU;对于 CUDA 张量类型,它将是当前 CUDA 设备。

  • requires_grad (bool, optional) – 是否应为返回的张量记录自动微分操作。默认值:False