<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/math.py#L733-L770) |

Real-valued Fast Fourier Transform along the last axis of the input.

    tf.keras.ops.rfft(
        x, fft_length=None
    )

Computes the 1D Discrete Fourier Transform of a real-valued signal over the
inner-most dimension of input.

Since the Discrete Fourier Transform of a real-valued signal is
Hermitian-symmetric, RFFT only returns the `fft_length / 2 + 1` unique
components of the FFT: the zero-frequency term, followed by the
`fft_length / 2` positive-frequency terms.

Along the axis RFFT is computed on, if `fft_length` is smaller than the
corresponding dimension of the input, the dimension is cropped. If it is
larger, the dimension is padded with zeros.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor. |
| `fft_length` | An integer representing the number of the fft length. If not specified, it is inferred from the length of the last axis of `x`. Defaults to `None`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tuple containing two tensors - the real and imaginary parts of the output. ||

<br />

#### Examples:

    x = keras.ops.convert_to_tensor([0.0, 1.0, 2.0, 3.0, 4.0])
    rfft(x)
    (array([10.0, -2.5, -2.5]), array([0.0, 3.4409548, 0.81229924]))

    rfft(x, 3)
    (array([3.0, -1.5]), array([0.0, 0.8660254]))