{"record":{"id":"404b4e474d522845","repo":"tensorflow/models","slug":"unknown-output-value-s-output-can-be-eithe-404b4e","errorCode":null,"errorMessage":"Unknown `output` value \"%s\". `output` can be either \"logits\" or \"predictions\"","messagePattern":"Unknown `output` value \"(.+?)\"\\. `output` can be either \"logits\" or \"predictions\"","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/networks/classification.py","lineNumber":73,"sourceCode":"    logits = tf_keras.layers.Dense(\n        num_classes,\n        activation=None,\n        kernel_initializer=initializer,\n        name='predictions/transform/logits')(\n            cls_output)\n\n    if output == 'logits':\n      output_tensors = logits\n    elif output == 'predictions':\n      policy = tf_keras.mixed_precision.global_policy()\n      if policy.name == 'mixed_bfloat16':\n        # b/158514794: bf16 is not stable with post-softmax cross-entropy.\n        policy = tf.float32\n      output_tensors = tf_keras.layers.Activation(\n          tf.nn.log_softmax, dtype=policy)(\n              logits)\n    else:\n      raise ValueError(\n          ('Unknown `output` value \"%s\". `output` can be either \"logits\" or '\n           '\"predictions\"') % output)\n\n    super().__init__(\n        inputs=[cls_output], outputs=output_tensors, **kwargs)\n\n    # b/164516224\n    # Once we've created the network using the Functional API, we call\n    # super().__init__ as though we were invoking the Functional API Model\n    # constructor, resulting in this object having all the properties of a model\n    # created using the Functional API. Once super().__init__ is called, we\n    # can assign attributes to `self` - note that all `self` assignments are\n    # below this line.\n    config_dict = {\n        'input_width': input_width,\n        'num_classes': num_classes,\n        'initializer': initializer,\n        'output': output,","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/networks/classification.py#L55-L91","documentation":"Error \"Unknown `output` value \"%s\". `output` can be either \"logits\" or \"predictions\"\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/networks/classification.py:73 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}