Rate this Page

torch.fft.ifftshift#

torch.fft.ifftshift(input,dim=None)Tensor#

Inverse offftshift().

Parameters
  • input (Tensor) – the tensor in FFT order

  • dim (int,Tuple[int],optional) – The dimensions to rearrange.Only dimensions specified here will be rearranged, any other dimensionswill be left in their original order.Default: All dimensions ofinput.

Example

>>>f=torch.fft.fftfreq(5)>>>ftensor([ 0.0000,  0.2000,  0.4000, -0.4000, -0.2000])

A round-trip throughfftshift() andifftshift() gives the same result:

>>>shifted=torch.fft.fftshift(f)>>>torch.fft.ifftshift(shifted)tensor([ 0.0000,  0.2000,  0.4000, -0.4000, -0.2000])