mindspore.ops.hann_window

View Source On Gitee
mindspore.ops.hann_window(window_length, periodic=True, *, dtype=None)[source]

Hann window function.

\[w(n) = \frac{1}{2} - \frac{1}{2} \cos\left(\frac{2\pi{n}}{M-1}\right),\qquad 0 \leq n \leq M-1\]
Parameters
  • window_length (int) – The size of window.

  • periodic (bool, optional) – If True , return a periodic window. If False, return a symmetric window. Default True .

Keyword Arguments

dtype (mindspore.dtype, optional) – The data type specified. Default None .

Returns

A 1-D tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> 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. ]