Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.ops.HammingWindow

class mindspore.ops.HammingWindow(periodic=True, alpha=0.54, beta=0.46, dtype=mstype.float32)[source]

Computes the hamming window function with input window length.

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

where N is the full window size.

Parameters
  • periodic (bool, optional) –

    a flag determines whether the returned window trims off the last duplicate value from the symmetric window. Default: True.

    • If True, returns a window to be used as periodic function, in above formula, N=length+1.

    • If False, return a symmetric window, N=length.

  • alpha (float, optional) – The coefficient α in the equation above. Default: 0.54.

  • beta (float, optional) – The coefficient β in the equation above. Default: 0.46.

  • dtype (mindspore.dtype, optional) – An optional data type of mindspore.dtype.float16, mindspore.dtype.float32 and mindspore.dtype.float64. Default: mindspore.dtype.float32.

Inputs:
  • length (Tensor) - a positive integer tensor controlling the returned window size, must be 1D.

Outputs:

Tensor, A 1-D tensor containing the window, whose shape is length.

Raises
  • TypeError – If length is not a Tensor.

  • TypeError – If dtype of length is not integer data type.

  • TypeError – If periodic is not a bool.

  • TypeError – If alpha is not a float.

  • TypeError – If beta is not a float.

  • TypeError – If dtype is not mindspore.float16, mindspore.float32 or mindspore.float64.

  • ValueError – If dimension of length is not 1.

  • ValueError – If data of length is negative.

Supported Platforms:

GPU CPU

Examples

>>> # case 1: periodic=True.
>>> length = Tensor(np.array([6]).astype(np.int32))
>>> hamming_window = ops.HammingWindow(periodic=True)
>>> y = hamming_window(length)
>>> print(y)
[0.08000001 0.31       0.77000004 1.         0.77000004 0.31      ]
>>> # case 2: periodic=False.
>>> length = Tensor(np.array([7]).astype(np.int32))
>>> hamming_window = ops.HammingWindow(periodic=False)
>>> y = hamming_window(length)
>>> print(y)
[0.08000001 0.31       0.77000004 1.         0.77000004 0.31       0.08000001]