tf.signal.fftshift

View source on GitHub

Shift the zero-frequency component to the center of the spectrum.

tf.signal.fftshift(
    x, axes=None, name=None
)

This function swaps half-spaces for all axes listed (defaults to all). Note that y[0] is the Nyquist component only if len(x) is even.

For example:

x = tf.signal.fftshift([ 0.,  1.,  2.,  3.,  4., -5., -4., -3., -2., -1.])
x.numpy() # array([-5., -4., -3., -2., -1.,  0.,  1.,  2.,  3.,  4.])

Args:

Returns:

A Tensor, The shifted tensor.

Numpy Compatibility

Equivalent to numpy.fft.fftshift. https://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.fftshift.html