TensorPlay
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-08

tensorplay.signal.windows.gaussian

tensorplay.signal.windows.gaussian(M: int, *, std: float = 1.0, sym: bool = True, dtype: dtype | None = None, layout: Layout = tensorplay.strided, device: device | None = None, requires_grad: bool = False) → Tensor[source]

Computes a window with a Gaussian waveform.

The samples follow a Gaussian bump centered in the window:

wn=exp⁡(−(n2σ)2)w_n = \exp{\left(-\left(\frac{n}{2\sigma}\right)^2\right)}

The window is scaled so that its largest value is 1. The value 1 itself does not occur when M is even and sym is True.

Parameters:

M (int) – number of points of the returned window.

Keyword Arguments:
  • std (float, optional) – standard deviation of the Gaussian; it controls how narrow or wide the window is. Default: 1.0.

  • sym (bool, optional) – if False, returns a periodic window, which is the usual choice for spectral analysis. If True, returns a symmetric window, which is the usual choice for filter design. Default: True.

  • dtype (tensorplay.dtype, optional) – the desired data type of the returned tensor. Default: if None, uses the global default (see tensorplay.set_default_dtype()).

  • layout (tensorplay.Layout, optional) – the desired layout of the returned tensor. Default: tensorplay.strided.

  • device (tensorplay.device, optional) – the desired device of the returned tensor. Default: if None, uses the current default tensor device (see tensorplay.set_default_device()).

  • requires_grad (bool, optional) – whether autograd should record operations on the returned tensor. Default: False.

Examples:

>>> # Symmetric Gaussian window of length 10 with std 1.0.
>>> tensorplay.signal.windows.gaussian(10)
tensor([0., 0.0022, 0.0439, 0.3247, 0.8825, 0.8825, 0.3247, 0.0439, 0.0022, 0.])

>>> # Periodic Gaussian window of length 10 with std 0.9.
>>> tensorplay.signal.windows.gaussian(10, sym=False, std=0.9)
tensor([0., 0.0001, 0.0039, 0.0847, 0.5394, 1., 0.5394, 0.0847, 0.0039, 0.0001])

On this page

Ask DeepWiki