PyTorch torch.hamming_window function
PyTorch torch reference manual
torch.hamming_window A function in PyTorch for generating a Hamming window. The Hamming window is a weighted cosine window function widely used in signal analysis for speech processing and communication systems.
Function definition
torch.hamming_window(window_length, periodic=True, alpha=0.54, beta=0.46, dtype=None, layout=torch.strided, device=None, requires_grad=False)
Usage examples
Example
import
torch
Create a Hamming window of length 512
window
=
torch.
hamming_window
(
512
)
(
"Hamming window shape:"
,
window.
shape
)
(
"First 5 values of the window:"
,
window
[
:
5
]
)
Customize the alpha and beta parameters
window2
=
torch.
hamming_window
(
256
,
alpha
=
0.54
,
beta
=
0.46
)
(
"Custom window shape:"
,
window2.
shape
)