torch.hamming_window#
- torch.hamming_window(window_length,*,dtype=None,layout=None,device=None,pin_memory=False,requires_grad=False)→Tensor#
Hamming window function.
where is the full window size.
The input
window_lengthis a positive integer controlling thereturned window size.periodicflag determines whether the returnedwindow trims off the last duplicate value from the symmetric window and isready to be used as a periodic window with functions liketorch.stft(). Therefore, ifperiodicis true, the inabove formula is in fact. Also, we always havetorch.hamming_window(L,periodic=True)equal totorch.hamming_window(L+1,periodic=False)[:-1]).Note
If
window_length, the returned window contains a single value 1.Note
This is a generalized version of
torch.hann_window().- Parameters
window_length (int) – the size of returned window
- Keyword Arguments
dtype (
torch.dtype, optional) – the desired data type of returned tensor.Default: ifNone, uses a global default (seetorch.set_default_dtype()). Only floating point types are supported.layout (
torch.layout, optional) – the desired layout of returned window tensor. Onlytorch.strided(dense layout) is supported.device (
torch.device, optional) – the desired device of returned tensor.Default: ifNone, uses the current device for the default tensor type(seetorch.set_default_device()).devicewill be the CPUfor CPU tensor types and the current CUDA device for CUDA tensor types.pin_memory (bool,optional) – If set, returned tensor would be allocated inthe pinned memory. Works only for CPU tensors. Default:
False.requires_grad (bool,optional) – If autograd should record operations on thereturned tensor. Default:
False.
- Returns
A 1-D tensor of size containing the window.
- Return type
- torch.hamming_window(window_length,periodic,*,dtype=None,layout=None,device=None,pin_memory=False,requires_grad=False)→Tensor
Hamming window function with periodic specified.
- Parameters
- Keyword Arguments
dtype (
torch.dtype, optional) – the desired data type of returned tensor.Default: ifNone, uses a global default (seetorch.set_default_dtype()). Only floating point types are supported.layout (
torch.layout, optional) – the desired layout of returned window tensor. Onlytorch.strided(dense layout) is supported.device (
torch.device, optional) – the desired device of returned tensor.Default: ifNone, uses the current device for the default tensor type(seetorch.set_default_device()).devicewill be the CPUfor CPU tensor types and the current CUDA device for CUDA tensor types.pin_memory (bool,optional) – If set, returned tensor would be allocated inthe pinned memory. Works only for CPU tensors. Default:
False.requires_grad (bool,optional) – If autograd should record operations on thereturned tensor. Default:
False.
- Returns
A 1-D tensor of size containing the window.
- Return type
- torch.hamming_window(window_length,periodic,floatalpha,*,dtype=None,layout=None,device=None,pin_memory=False,requires_grad=False)→Tensor
Hamming window function with periodic and alpha specified.
- Parameters
- Keyword Arguments
dtype (
torch.dtype, optional) – the desired data type of returned tensor.Default: ifNone, uses a global default (seetorch.set_default_dtype()). Only floating point types are supported.layout (
torch.layout, optional) – the desired layout of returned window tensor. Onlytorch.strided(dense layout) is supported.device (
torch.device, optional) – the desired device of returned tensor.Default: ifNone, uses the current device for the default tensor type(seetorch.set_default_device()).devicewill be the CPUfor CPU tensor types and the current CUDA device for CUDA tensor types.pin_memory (bool,optional) – If set, returned tensor would be allocated inthe pinned memory. Works only for CPU tensors. Default:
False.requires_grad (bool,optional) – If autograd should record operations on thereturned tensor. Default:
False.
- Returns
A 1-D tensor of size containing the window.
- Return type
- torch.hamming_window(window_length,periodic,floatalpha,floatbeta,*,dtype=None,layout=None,device=None,pin_memory=False,requires_grad=False)→Tensor
Hamming window function with periodic, alpha and beta specified.
- Parameters
- Keyword Arguments
dtype (
torch.dtype, optional) – the desired data type of returned tensor.Default: ifNone, uses a global default (seetorch.set_default_dtype()). Only floating point types are supported.layout (
torch.layout, optional) – the desired layout of returned window tensor. Onlytorch.strided(dense layout) is supported.device (
torch.device, optional) – the desired device of returned tensor.Default: ifNone, uses the current device for the default tensor type(seetorch.set_default_device()).devicewill be the CPUfor CPU tensor types and the current CUDA device for CUDA tensor types.pin_memory (bool,optional) – If set, returned tensor would be allocated inthe pinned memory. Works only for CPU tensors. Default:
False.requires_grad (bool,optional) – If autograd should record operations on thereturned tensor. Default:
False.
- Returns
A 1-D tensor of size containing the window.
- Return type