Tensorflow.js tf.spectral.ifft () Function
Last Updated :
10 May, 2021
Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment.
The tf.spectral.ifft() function is used for IFFT(Inverse Fast Fourier transform) i.e. it computes the inverse 1-dimensional DFT(discrete Fourier transform) over the inner-most dimension of the input.
Syntax:
tf.spectral.ifft(input)
Parameters:
- input: The complex input on which an ifft is being performed.
Return Value: It returns the result for the computation of the inverse 1-dimensional DFT(discrete Fourier transform) over the inner-most dimension of the input.
Example 1:
Javascript
import * as tf from "@tensorflow/tfjs"
const real = tf.tensor1d([1, 5]);
const imag = tf.tensor1d([2, 4]);
const x = tf.complex(real, imag);
tf.spectral.ifft(x).print();
|
Output:
Tensor
[3 + 3j, -2 + -1j]
Example 2:
Javascript
import * as tf from "@tensorflow/tfjs"
const x = tf.complex(tf.tensor1d([5, 10, 15, 20]), tf.tensor1d([1, 2, 3, 4]));
tf.spectral.ifft(x).print();
|
Output:
Tensor
[12.5 + 2.5j, -2 + -3j, -2.5 + -0.5j, -3 + 2j]
Reference: https://js.tensorflow.org/api/latest/#spectral.ifft
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...