torch_hann_window {torch} | R Documentation |
Hann_window
Description
Hann_window
Usage
torch_hann_window(
window_length,
periodic = TRUE,
dtype = NULL,
layout = NULL,
device = NULL,
requires_grad = FALSE
)
Arguments
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. |
dtype |
( |
layout |
( |
device |
( |
requires_grad |
(bool, optional) If autograd should record operations on the returned tensor. Default: |
hann_window(window_length, periodic=TRUE, dtype=NULL, layout=torch.strided, device=NULL, requires_grad=False) -> Tensor
Hann window function.
w[n] = \frac{1}{2}\ \left[1 - \cos \left( \frac{2 \pi n}{N - 1} \right)\right] =
\sin^2 \left( \frac{\pi n}{N - 1} \right),
where N
is the full window size.
The input window_length
is a positive integer controlling the
returned window size. periodic
flag 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 periodic
is true, the N
in
above formula is in fact \mbox{window\_length} + 1
. Also, we always have
torch_hann_window(L, periodic=TRUE)
equal to
torch_hann_window(L + 1, periodic=False)[:-1])
.
Note
If `window_length` \eqn{=1}, the returned window contains a single value 1.