# Complex Number Functions

TensorFlow provides several operations that you can use to add complex number functions to your graph.

### tf.complex(real, imag, name=None)

Converts two real numbers to a complex number.

Given a tensor real representing the real part of a complex number, and a tensor imag representing the imaginary part of a complex number, this operation returns complex numbers elementwise of the form (a + bj), where a represents the real part and b represents the imag part.

The input tensors real and imag must have the same shape.

For example:

# tensor 'real' is [2.25, 3.25]
# tensor imag is [4.75, 5.75]
tf.complex(real, imag) ==> [[2.25 + 4.75j], [3.25 + 5.75j]]

##### Args:
• real: A Tensor. Must be one of the following types: float32, float64.
• imag: A Tensor. Must have the same type as real.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64 or complex128.

### tf.complex_abs(x, name=None)

Computes the complex absolute value of a tensor.

Given a tensor x of complex numbers, this operation returns a tensor of type float32 or float64 that is the absolute value of each element in x. All elements in x must be complex numbers of the form $$a + bj$$. The absolute value is computed as $$\sqrt{a^2 + b^2}$$.

For example:

# tensor 'x' is [[-2.25 + 4.75j], [-3.25 + 5.75j]]
tf.complex_abs(x) ==> [5.25594902, 6.60492229]

##### Args:
• x: A Tensor of type complex64 or complex128.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type float32 or float64.

### tf.conj(input, name=None)

Returns the complex conjugate of a complex number.

Given a tensor input of complex numbers, this operation returns a tensor of complex numbers that are the complex conjugate of each element in input. The complex numbers in input must be of the form $$a + bj$$, where a is the real part and b is the imaginary part.

The complex conjugate returned by this operation is of the form $$a - bj$$.

For example:

# tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
tf.conj(input) ==> [-2.25 - 4.75j, 3.25 - 5.75j]

##### Args:
• input: A Tensor. Must be one of the following types: complex64, complex128.
• name: A name for the operation (optional).
##### Returns:

A Tensor. Has the same type as input.

### tf.imag(input, name=None)

Returns the imaginary part of a complex number.

Given a tensor input of complex numbers, this operation returns a tensor of type float32 or float64 that is the imaginary part of each element in input. All elements in input must be complex numbers of the form (a + bj), where a is the real part and b is the imaginary part returned by this operation.

For example:

# tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
tf.imag(input) ==> [4.75, 5.75]

##### Args:
• input: A Tensor. Must be one of the following types: complex64, complex128.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type float32 or float64.

### tf.real(input, name=None)

Returns the real part of a complex number.

Given a tensor input of complex numbers, this operation returns a tensor of type float32 or float64 that is the real part of each element in input. All elements in input must be complex numbers of the form (a + bj), where a is the real part returned by this operation and b is the imaginary part.

For example:

# tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
tf.real(input) ==> [-2.25, 3.25]

##### Args:
• input: A Tensor. Must be one of the following types: complex64, complex128.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type float32 or float64.

### tf.fft(input, name=None)

Compute the 1-dimensional discrete Fourier Transform.

##### Args:
• input: A Tensor of type complex64. A complex64 vector.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. The 1D Fourier Transform of input.

### tf.ifft(input, name=None)

.Doc(R"doc(

Compute the inverse 1-dimensional discrete Fourier Transform.

##### Args:
• input: A Tensor of type complex64. A complex64 vector.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. The inverse 1D Fourier Transform of input.

### tf.fft2d(input, name=None)

Compute the 2-dimensional discrete Fourier Transform.

##### Args:
• input: A Tensor of type complex64. A complex64 matrix.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. The 2D Fourier Transform of input.

### tf.ifft2d(input, name=None)

Compute the inverse 2-dimensional discrete Fourier Transform.

##### Args:
• input: A Tensor of type complex64. A complex64 matrix.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. The inverse 2D Fourier Transform of input.

### tf.fft3d(input, name=None)

Compute the 3-dimensional discrete Fourier Transform.

##### Args:
• input: A Tensor of type complex64. A complex64 3-D tensor.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. The 3D Fourier Transform of input.

### tf.ifft3d(input, name=None)

Compute the inverse 3-dimensional discrete Fourier Transform.

##### Args:
• input: A Tensor of type complex64. A complex64 3-D tensor.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. The inverse 3D Fourier Transform of input.

### tf.batch_fft(input, name=None)

Compute the 1-dimensional discrete Fourier Transform over the inner-most

dimension of input.

##### Args:
• input: A Tensor of type complex64. A complex64 tensor.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. A complex64 tensor of the same shape as input. The inner-most dimension of input is replaced with its 1D Fourier Transform.

### tf.batch_ifft(input, name=None)

Compute the inverse 1-dimensional discrete Fourier Transform over the inner-most

dimension of input.

##### Args:
• input: A Tensor of type complex64. A complex64 tensor.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. A complex64 tensor of the same shape as input. The inner-most dimension of input is replaced with its inverse 1D Fourier Transform.

### tf.batch_fft2d(input, name=None)

Compute the 2-dimensional discrete Fourier Transform over the inner-most

2 dimensions of input.

##### Args:
• input: A Tensor of type complex64. A complex64 tensor.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. A complex64 tensor of the same shape as input. The inner-most 2 dimensions of input are replaced with their 2D Fourier Transform.

### tf.batch_ifft2d(input, name=None)

Compute the inverse 2-dimensional discrete Fourier Transform over the inner-most

2 dimensions of input.

##### Args:
• input: A Tensor of type complex64. A complex64 tensor.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. A complex64 tensor of the same shape as input. The inner-most 2 dimensions of input are replaced with their inverse 2D Fourier Transform.

### tf.batch_fft3d(input, name=None)

Compute the 3-dimensional discrete Fourier Transform over the inner-most 3

dimensions of input.

##### Args:
• input: A Tensor of type complex64. A complex64 tensor.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. A complex64 tensor of the same shape as input. The inner-most 3 dimensions of input are replaced with their 3D Fourier Transform.

### tf.batch_ifft3d(input, name=None)

Compute the inverse 3-dimensional discrete Fourier Transform over the inner-most

3 dimensions of input.

##### Args:
• input: A Tensor of type complex64. A complex64 tensor.
• name: A name for the operation (optional).
##### Returns:

A Tensor of type complex64. A complex64 tensor of the same shape as input. The inner-most 3 dimensions of input are replaced with their inverse 3D Fourier Transform.