hann_window(window_length, periodic=True, dtype=None, layout=torch.strided, device=None, requires_grad=False) → Tensor¶
Hann window function.
where is the full window size.
window_lengthis a positive integer controlling the returned window size.
periodicflag determines whether the returned window trims off the last duplicate value from the symmetric window and is ready to be used as a periodic window with functions like
torch.stft(). Therefore, if
periodicis true, the in above formula is in fact . Also, we always have
torch.hann_window(L, periodic=True)equal to
torch.hann_window(L + 1, periodic=False)[:-1]).
window_length, the returned window contains a single value 1.
window_length (int) – the size of returned window
periodic (bool, optional) – If True, returns a window to be used as periodic function. If False, return a symmetric window.
torch.layout, optional) – the desired layout of returned window tensor. Only
torch.strided(dense layout) is supported.
torch.device, optional) – the desired device of returned tensor. Default: if
None, uses the current device for the default tensor type (see
devicewill be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types.
requires_grad (bool, optional) – If autograd should record operations on the returned tensor. Default:
A 1-D tensor of size containing the window
- Return type