mindspore.ops.hamming_window

View Source On Gitee
mindspore.ops.hamming_window(window_length, periodic=True, alpha=0.54, beta=0.46, *, dtype=None)[source]

Hamming window function.

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

where N is the full window size, and n is natural number less than N :[0, 1, …, N-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 .

  • alpha (float, optional) – The coefficient α. Default 0.54 .

  • beta (float, optional) – The coefficient β. Default 0.46 .

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