tensorflow/models · error · ValueError
Unknown `output` value "%s". `output` can be either "logits"
Error message
Unknown `output` value "%s". `output` can be either "logits" or "predictions"
What it means
Error "Unknown `output` value "%s". `output` can be either "logits" or "predictions"" thrown in tensorflow/models.
Source
Thrown at official/nlp/modeling/networks/classification.py:73
logits = tf_keras.layers.Dense(
num_classes,
activation=None,
kernel_initializer=initializer,
name='predictions/transform/logits')(
cls_output)
if output == 'logits':
output_tensors = logits
elif output == 'predictions':
policy = tf_keras.mixed_precision.global_policy()
if policy.name == 'mixed_bfloat16':
# b/158514794: bf16 is not stable with post-softmax cross-entropy.
policy = tf.float32
output_tensors = tf_keras.layers.Activation(
tf.nn.log_softmax, dtype=policy)(
logits)
else:
raise ValueError(
('Unknown `output` value "%s". `output` can be either "logits" or '
'"predictions"') % output)
super().__init__(
inputs=[cls_output], outputs=output_tensors, **kwargs)
# b/164516224
# Once we've created the network using the Functional API, we call
# super().__init__ as though we were invoking the Functional API Model
# constructor, resulting in this object having all the properties of a model
# created using the Functional API. Once super().__init__ is called, we
# can assign attributes to `self` - note that all `self` assignments are
# below this line.
config_dict = {
'input_width': input_width,
'num_classes': num_classes,
'initializer': initializer,
'output': output,View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/nlp/modeling/networks/classification.py:73 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/404b4e474d522845.
Report an issue: GitHub.