ConvolveΒΆ
- class torchaudio.transforms.Convolve(mode: str = 'full')[source]ΒΆ
Convolves inputs along their last dimension using the direct method. Note that, in contrast to
torch.nn.Conv1d
, which actually applies the valid cross-correlation operator, this module applies the true convolution operator.- Parameters
mode (str, optional) β
Must be one of (βfullβ, βvalidβ, βsameβ).
βfullβ: Returns the full convolution result, with shape (β¦, N + M - 1), where N and M are the trailing dimensions of the two inputs. (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).
- forward(x: Tensor, y: Tensor) Tensor [source]ΒΆ
- 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
).
- Returns
Result of convolving
x
andy
, with shape (β¦, L), where the leading dimensions match those ofx
and L is dictated bymode
.- Return type