tfm.nlp.layers.FourierTransformLayer
Stay organized with collections
Save and categorize content based on your preferences.
Fourier Transform layer.
tfm.nlp.layers.FourierTransformLayer(
use_fft: bool = False, name: str = 'fourier_transform', **kwargs
)
Applies 2D Fourier Transform over final two dimensions of query inputs -
typically the sequence and hidden dimensions.
Args |
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
call(
query: tf.Tensor, value: tf.Tensor, **kwargs
) -> tf.Tensor
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].
|
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 2026-11-06 UTC.
[null,null,["Last updated 2026-11-06 UTC."],[],[]]