mindspore.ops.hann_window

查看源文件
mindspore.ops.hann_window(window_length, periodic=True, *, dtype=None)[源代码]

汉宁窗口函数。

w(n)=1212cos(2πnM1),0nM1
参数:
  • window_length (int) - 窗口的大小。

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

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

返回:

一维tensor。

支持平台:

Ascend GPU CPU

样例:

>>> import mindspore
>>> output = mindspore.ops.hann_window(5)
>>> print(output)
[0.        0.3454915 0.9045085 0.9045085 0.3454915]
>>> output = mindspore.ops.hann_window(5, periodic=False)
>>> print(output)
[0.  0.5 1.  0.5 0. ]