mindspore.ops.hamming_window

查看源文件
mindspore.ops.hamming_window(window_length, periodic=True, alpha=0.54, beta=0.46, *, dtype=None)[源代码]

汉明窗口函数。

w[n]=αβcos(2πnN1),

其中, N 是总的窗口长度 window_length ,n为小于 N 的自然数 [0, 1, …, N-1]。

参数:
  • window_length (int) - 窗口的大小。

  • periodic (bool, 可选) - 如果为 True ,表示返回周期窗口。如果为 False ,表示返回对称窗口。默认 True

  • alpha (float, 可选) - 系数α。默认 0.54

  • beta (float, 可选) - 系数β。默认 0.46

关键字参数:
  • dtype (mindspore.dtype, 可选) - 指定数据类型。默认 None

返回:

一维tensor。

支持平台:

Ascend GPU CPU

样例:

>>> import mindspore
>>> output = mindspore.ops.hamming_window(5)
>>> print(output)
[0.08000001 0.3978522  0.9121478  0.9121478  0.3978522 ]
>>> output = mindspore.ops.hamming_window(5, periodic=False)
>>> print(output)
[0.08000001 0.54       1.         0.54       0.08000001]