tf.keras.ops.rfft
Stay organized with collections
Save and categorize content based on your preferences.
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.
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 .
|
Returns |
A tuple containing two tensors - the real and imaginary parts of the
output.
|
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]))
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-06-07 UTC.
[null,null,["Last updated 2024-06-07 UTC."],[],[],null,["# tf.keras.ops.rfft\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/keras-team/keras/tree/v3.3.3/keras/src/ops/math.py#L488-L525) |\n\nReal-valued Fast Fourier Transform along the last axis of the input. \n\n tf.keras.ops.rfft(\n x, fft_length=None\n )\n\nComputes the 1D Discrete Fourier Transform of a real-valued signal over the\ninner-most dimension of input.\n\nSince the Discrete Fourier Transform of a real-valued signal is\nHermitian-symmetric, RFFT only returns the `fft_length / 2 + 1` unique\ncomponents of the FFT: the zero-frequency term, followed by the\n`fft_length / 2` positive-frequency terms.\n\nAlong the axis RFFT is computed on, if `fft_length` is smaller than the\ncorresponding dimension of the input, the dimension is cropped. If it is\nlarger, the dimension is padded with zeros.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `x` | Input tensor. |\n| `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`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A tuple containing two tensors - the real and imaginary parts of the output. ||\n\n\u003cbr /\u003e\n\n#### Examples:\n\n x = keras.ops.convert_to_tensor([0.0, 1.0, 2.0, 3.0, 4.0])\n rfft(x)\n (array([10.0, -2.5, -2.5]), array([0.0, 3.4409548, 0.81229924]))\n\n rfft(x, 3)\n (array([3.0, -1.5]), array([0.0, 0.8660254]))"]]