ifftr#

class diffsptk.RealValuedInverseFastFourierTransform(fft_length: int, out_length: int | None = None, learnable: bool = False, device: device | None = None, dtype: dtype | None = None)[source]#

See this page for details.

Parameters:
fft_lengthint >= 2

The FFT length, \(L\).

out_lengthint >= 1 or None

The output length, \(N\).

learnablebool

Whether to make the DFT basis learnable. If True, the module performs DFT rather than FFT.

devicetorch.device or None

The device of this module.

dtypetorch.dtype or None

The data type of this module.

forward(y: Tensor) Tensor[source]#

Compute inverse FFT of a complex spectrum.

Parameters:
yTensor [shape=(…, L/2+1)]

The complex input spectrum.

Returns:
outTensor [shape=(…, N)]

The real output signal.

Examples

>>> x = diffsptk.ramp(1, 3)
>>> x
tensor([1., 2., 3.])
>>> fftr = diffsptk.RealValuedFastFourierTransform(8)
>>> ifftr = diffsptk.RealValuedInverseFastFourierTransform(8, 3)
>>> x2 = ifftr(fftr(x))
>>> x2
tensor([1., 2., 3.])
diffsptk.functional.ifftr(y: Tensor, out_length: int | None = None) Tensor[source]#

Compute inverse FFT of a complex spectrum.

Parameters:
yTensor [shape=(…, L/2+1)]

The complex input spectrum.

out_lengthint or None

The output length, \(N\).

Returns:
outTensor [shape=(…, N)]

The real output signal.

See also

fftr istft