tfm.nlp.layers.FourierTransformLayer

Fourier Transform layer.

Applies 2D Fourier Transform over final two dimensions of query inputs - typically the sequence and hidden dimensions.

use_fft Whether to use Fast Fourier Transform (True) or the Discrete Fourier Transform (DFT) matrix (False) to compute the Fourier Transform. See _pick_fourier_transform() for recommendations on when to use FFT or DFT.
name Name for layer.
**kwargs Keyword arguments.

Methods

call

View source

Applies layer to query.

Args
query Batch of input embeddings, typically of shape [batch_size, max_seq_length, hidden_dim].
value Unused. Included to match attention layer API.
**kwargs Optional arguments to catch unused attention keyword arguments.

Returns
Real part of discrete Fourier Transform of query inputs with shape [batch_size, max_seq_length, hidden_dim].