November 2019
Intermediate to advanced
296 pages
7h 52m
English
In this section, we are going to try to recover the original curve by running the inversed Fourier transform, that is, tf.ifft. Fourier transformation has an inverted operation, as we mentioned at the beginning of this chapter. By running a similar computation, we can recover the original function from the magnitudes of the frequencies. TensorFlow.js has an API that does this for us. Since the input and output are interchangeable, the output of tf.fft can be directly passed to tf.ifft:
const pi = tf.scalar(2.0 * Math.PI);const xs = tf.mul(pi, tf.range(-1.5, 1.5, 0.05));const xs2 = tf.mul(pi, tf.range(-1.5, 1.5, 0.05)).mul(2.0);const ys = tf.cos(xs).add(tf.cos(xs2).mul(0.2));const transformed = tf.fft(tf.complex(ys, ...
Read now
Unlock full access