mindspore.ops.hamming_window

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

Returns the Hamming window.

\[w[n]=\alpha − \beta \cos \left( \frac{2 \pi n}{N - 1} \right),\]

where \(N\) is the full window size.

Parameters
  • window_length (int) – The size of returned window. Must be a non negative integer.

  • 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 output window data type. Default: None .

Returns

Tensor, a 1-D tensor of size (window_length) containing the window.

Raises
  • TypeError – If window_length is a negative integer.

  • TypeError – If periodic is not bool.

Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore import ops
>>> print(ops.hamming_window(6, False))
[0.08 0.39785218 0.91214782  0.91214782  0.39785218 0.08]