{"record":{"id":"1d279add19099a6b","repo":"tensorflow/models","slug":"unexpected-dtype-s","errorCode":null,"errorMessage":"Unexpected dtype: %s","messagePattern":"Unexpected dtype: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/modeling/performance.py","lineNumber":53,"sourceCode":"      optimizer = tf_keras.mixed_precision.LossScaleOptimizer(\n          optimizer, dynamic=False, initial_scale=loss_scale)\n  return optimizer\n\n\ndef set_mixed_precision_policy(dtype, loss_scale=None):\n  \"\"\"Sets the global `tf_keras.mixed_precision.Policy`.\"\"\"\n  # TODO(b/191894773): Remove loss_scale argument\n  assert loss_scale is None, (\n      'The loss_scale argument must be None. The argument exists for '\n      'historical reasons and will be removed soon.')\n  if dtype == tf.float16:\n    tf_keras.mixed_precision.set_global_policy('mixed_float16')\n  elif dtype == tf.bfloat16:\n    tf_keras.mixed_precision.set_global_policy('mixed_bfloat16')\n  elif dtype == tf.float32:\n    tf_keras.mixed_precision.set_global_policy('float32')\n  else:\n    raise ValueError('Unexpected dtype: %s' % dtype)\n","sourceCodeStart":35,"sourceCodeEnd":54,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/modeling/performance.py#L35-L54","documentation":"Error \"Unexpected dtype: %s\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/modeling/performance.py:53 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"}