tfm.nlp.layers.MultiClsHeads
Stay organized with collections
Save and categorize content based on your preferences.
Pooling heads sharing the same pooling stem.
tfm.nlp.layers.MultiClsHeads(
inner_dim,
cls_list,
cls_token_idx=0,
activation='tanh',
dropout_rate=0.0,
initializer='glorot_uniform',
**kwargs
)
Args |
inner_dim
|
The dimensionality of inner projection layer. If 0 or None
then only the output projection layer is created.
|
cls_list
|
a list of pairs of (classification problem name and the numbers
of classes.
|
cls_token_idx
|
The index inside the sequence to pool.
|
activation
|
Dense layer activation.
|
dropout_rate
|
Dropout probability.
|
initializer
|
Initializer for dense layer kernels.
|
**kwargs
|
Keyword arguments.
|
Attributes |
checkpoint_items
|
|
Methods
call
View source
call(
features: tf.Tensor, only_project: bool = False
)
Implements call().
| Args |
features
|
a rank-3 Tensor when self.inner_dim is specified, otherwise
it is a rank-2 Tensor.
|
only_project
|
a boolean. If True, we return the intermediate Tensor
before projecting to class logits.
|
| Returns |
|
If only_project is True, a Tensor with shape= [batch size, hidden size].
If only_project is False, a dictionary of Tensors.
|
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-11-06 UTC."],[],[]]