Class Fft
java.lang.Object
ai.beestream.jitnn.Fft
Fourier transforms after torch.fft, and the short-time transforms torch.stft and torch.istft.
Complex tensors are real tensors with a trailing axis of 2 (re, im), as torch.view_as_real gives
them;
dim counts the complex axes only. All transforms are differentiable.
The transforms are direct sums, O(n^2) per row (see FftKernels): right for the
lengths found in models (window sizes, sequence mixing), not for very long signals.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumScaling, torch'snorm: BACKWARD scales the inverse by 1/n, ORTHO both by 1/sqrt(n), FORWARD the forward by 1/n. -
Method Summary
Modifier and TypeMethodDescriptionstatic Tensortorch.fft.fft of complex x along the last axis, full length, BACKWARD scaling.static Tensortorch.fft.fft of complex x [..., 2]; n > 0 crops or zero-pads axisdimto n.static Tensortorch.fft.fft2: the transform over the last two complex axes.static Tensortorch.fft.ifft of complex x along the last axis, full length, BACKWARD scaling (1/n).static Tensortorch.fft.ifft.static Tensortorch.fft.ifft2.static Tensortorch.fft.irfft along the last axis: a real signal of length 2 (m - 1), BACKWARD scaling (1/n).static Tensortorch.fft.irfft: the real signal of length n (default 2 (m - 1)) whose spectrum's non-negative half is x [..., m, 2]; the imaginary parts at frequency 0 and n / 2 are ignored.static Tensortorch.istft(x, nFft, hop, window=window, center, normalized, onesided=True, length): x [(B,) nFft / 2 + 1, frames, 2] back to [(B,) length] (length <= 0: as long as the frames reach, less the centre padding), by overlap-add divided by the summed squared window.static Tensortorch.fft.rfft of real x along the last axis, full length, BACKWARD scaling.static Tensortorch.fft.rfft of real x: the n / 2 + 1 non-negative frequencies, complex [..., n / 2 + 1, 2].static Tensortorch.fft.rfft2: rfft over the last axis, then fft over the one before.static Tensortorch.stft(x, nFft, hop, window=window, center, pad_mode="reflect", normalized, onesided=True, return_complex=True) as real pairs: x [L] or [B, L] gives [(B,) nFft / 2 + 1, frames, 2].
-
Method Details
-
fft
-
fft
-
ifft
-
ifft
-
rfft
-
rfft
-
irfft
-
irfft
-
fft2
-
ifft2
-
rfft2
-
stft
public static Tensor stft(Tensor x, int nFft, int hop, Tensor window, boolean center, boolean normalized) torch.stft(x, nFft, hop, window=window, center, pad_mode="reflect", normalized, onesided=True, return_complex=True) as real pairs: x [L] or [B, L] gives [(B,) nFft / 2 + 1, frames, 2]. The window has nFft entries (null for a rectangular one). -
istft
public static Tensor istft(Tensor x, int nFft, int hop, Tensor window, boolean center, boolean normalized, int length) torch.istft(x, nFft, hop, window=window, center, normalized, onesided=True, length): x [(B,) nFft / 2 + 1, frames, 2] back to [(B,) length] (length <= 0: as long as the frames reach, less the centre padding), by overlap-add divided by the summed squared window.
-