Shortcuts

torchaudio.functional.fftconvolve

torchaudio.functional.fftconvolve(x: Tensor, y: Tensor, mode: str = 'full') Tensor[source]

Convolves inputs along their last dimension using FFT. For inputs with large last dimensions, this function is generally much faster than convolve(). Note that, in contrast to torch.nn.functional.conv1d(), which actually applies the valid cross-correlation operator, this function applies the true convolution operator. Also note that this function can only output float tensors (int tensor inputs will be cast to float).

This feature supports the following devices: CPU, CUDA This API supports the following properties: Autograd, TorchScript
Parameters:
  • x (torch.Tensor) – First convolution operand, with shape (…, N).

  • y (torch.Tensor) – Second convolution operand, with shape (…, M) (leading dimensions must be broadcast-able with those of x).

  • mode (str, optional) –

    Must be one of (“full”, “valid”, “same”).

    • ”full”: Returns the full convolution result, with shape (…, N + M - 1). (Default)

    • ”valid”: Returns the segment of the full convolution result corresponding to where the two inputs overlap completely, with shape (…, max(N, M) - min(N, M) + 1).

    • ”same”: Returns the center segment of the full convolution result, with shape (…, N).

Returns:

Result of convolving x and y, with shape (…, L), where the leading dimensions match those of x and L is dictated by mode.

Return type:

torch.Tensor

Tutorials using fftconvolve:
Audio Data Augmentation

Audio Data Augmentation

Audio Data Augmentation

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources