tfmri.signal.fft

fft(x, shape=None, axes=None, norm='backward', shift=False)[source]

Computes the N-dimensional discrete Fourier Transform.

This function computes the N-dimensional discrete Fourier Transform over any number of axes in an M-dimensional array by means of the Fast Fourier Transform (FFT).

Note

N must be 1, 2 or 3.

Parameters
  • x – A Tensor. Must be one of the following types: complex64, complex128.

  • shape – A Tensor, a TensorShape or a list of ints. Shape (length of each transformed axis) of the output (s[0] refers to axis 0, s[1] to axis 1, etc.). Along any axis, if the given shape is smaller than that of the input, the input is cropped. If it is larger, the input is padded with zeros. If shape is not given, the shape of the input along the axes specified by axes is used.

  • axes – A Tensor, a TensorShape or a list of ints. Axes over which to compute the FFT. If not given, the last len(shape) axes are used, or all axes if shape is also not specified.

  • norm – A string. The normalization mode. Must be one of "forward", "backward" or "ortho". Defaults to "backward". Indicates which direction of the forward/backward pair of transforms is scaled and with what normalization factor.

  • shift – A boolean. If True, perform a “centered” transform by appropriately shifting the inputs/outputs (eg, shifting zero-frequency components to the center of the spectrum).

Returns

The truncated or zero-padded input tensor, transformed along the axes indicated by axes, or by a combination of shape and axes, as explained in the parameters section above.

Raises
  • TypeError – If x is not of a complex type.

  • InvalidArgumentError – If length of shape is greater than the rank of x.

  • InvalidArgumentError – If length of axes is greater than the rank of x.

  • InvalidArgumentError – If any element of axes is larger than the number of axes of x.

  • InvalidArgumentError – If shape and axes have different length.

  • ValueError – If norm is not one of ‘forward’, ‘backward’ or ‘ortho’.