tfm.nlp.layers.LinearTransformLayer
Stay organized with collections
Save and categorize content based on your preferences.
Dense, linear transformation layer.
tfm.nlp.layers.LinearTransformLayer(
kernel_initializer: _Initializer = default_kernel_initializer,
name: str = 'linear_transform',
**kwargs
)
Applies matrix multiplications over sequence and hidden dimensions.
Args |
kernel_initializer
|
Initialization scheme for kernel.
|
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 |
Linearly transformed 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."],[],[]]