torch.hann_window(
window_length,
periodic=True,
*,
dtype=None,
layout=torch.strided,
device=None,
requires_grad=False
) -> Tensor
For more information, see torch.hann_window.
mindspore.numpy.hanning(M) -> Tensor
For more information, see mindspore.numpy.hanning.
PyTorch: Return the Hanning window with the same size as window_length. The periodic parameter determines whether the returned window will remove the last duplicate value of the symmetric window.
MindSpore: MindSpore API basically implements the same function as PyTorch, but it lacks the parameter periodic, which is equivalent to setting periodic to False.
Categories | Subcategories | PyTorch | MindSpore | Difference |
---|---|---|---|---|
Input | Single input | window_length | M | Same function, different parameter names |
Parameters | Parameter 1 | periodic | - | Equivalent to setting periodic to False in MindSpore |
Parameter 2 | dtype | - | MindSpore does not have this parameter, and the output dtype is Float32, consistent with the default of the marker | |
Parameter 3 | layout | - | Not involved | |
Parameter 4 | device | - | Not involved | |
Parameter 5 | requires_grad | - | MindSpore does not have this parameter and supports reverse derivation by default |
The periodic parameter in the PyTorch operator determines whether the return window will remove the last repeated value of the symmetric window, while the MindSpore operator lacks the parameter, equivalent to setting periodic to False.
# PyTorch
import torch
torch_output = torch.hann_window(12, periodic=False)
print(torch_output.numpy())
# [0. 0.07937324 0.29229248 0.57115734 0.82743037 0.97974646
# 0.9797465 0.8274305 0.5711575 0.29229265 0.07937327 0. ]
# MindSpore
import mindspore
ms_output = mindspore.numpy.hanning(12)
print(ms_output)
# [0. 0.07937324 0.29229248 0.57115734 0.82743037 0.97974646
# 0.9797465 0.8274305 0.5711575 0.29229265 0.07937327 0. ]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。