Rate this Page

torch.fft.ihfftn#

torch.fft.ihfftn(input,s=None,dim=None,norm=None,*,out=None)Tensor#

Computes the N-dimensional inverse discrete Fourier transform of realinput.

input must be a real-valued signal, interpreted in the Fourier domain.The n-dimensional IFFT of a real signal is Hermitian-symmetric,X[i,j,...]=conj(X[-i,-j,...]).ihfftn() representsthis in the one-sided form where only the positive frequencies below theNyquist frequency are included in the last signal dimension. To compute thefull output, useifftn().

Note

Supports torch.half on CUDA with GPU Architecture SM53 or greater.However it only supports powers of 2 signal length in every transformed dimensions.

Parameters:
  • input (Tensor) – the input tensor

  • s (Tuple[int],optional) – Signal size in the transformed dimensions.If given, each dimensiondim[i] will either be zero-padded ortrimmed to the lengths[i] before computing the Hermitian IFFT.If a length-1 is specified, no padding is done in that dimension.Default:s=[input.size(d)fordindim]

  • dim (Tuple[int],optional) – Dimensions to be transformed.Default: all dimensions, or the lastlen(s) dimensions ifs is given.

  • norm (str,optional) –

    Normalization mode. For the backward transform(ihfftn()), these correspond to:

    • "forward" - no normalization

    • "backward" - normalize by1/n

    • "ortho" - normalize by1/sqrt(n) (making the Hermitian IFFT orthonormal)

    Wheren=prod(s) is the logical IFFT size.Calling the forward transform (hfftn()) with the samenormalization mode will apply an overall normalization of1/n betweenthe two transforms. This is required to makeihfftn()the exact inverse.

    Default is"backward" (normalize by1/n).

Keyword Arguments:

out (Tensor,optional) – the output tensor.

Example

>>>T=torch.rand(10,10)>>>ihfftn=torch.fft.ihfftn(T)>>>ihfftn.size()torch.Size([10, 6])

Compared against the full output fromifftn(), we have allelements up to the Nyquist frequency.

>>>ifftn=torch.fft.ifftn(t)>>>torch.allclose(ifftn[...,:6],ihfftn)True

The discrete Fourier transform is separable, soihfftn()here is equivalent to a combination ofihfft() andifft():

>>>two_iffts=torch.fft.ifft(torch.fft.ihfft(t,dim=1),dim=0)>>>torch.allclose(ihfftn,two_iffts)True