{"record":{"id":"97b5b349fbaa550f","repo":"tensorflow/models","slug":"invalid-dtype-s","errorCode":null,"errorMessage":"Invalid dtype: %s","messagePattern":"Invalid dtype: (.+?)","errorType":"exception","errorClass":"AssertionError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/ops/beam_search.py","lineNumber":40,"sourceCode":"  \"\"\"Returns a value close to infinity, but is still finite in `dtype`.\n\n  This is useful to get a very large value that is still zero when multiplied by\n  zero. The floating-point \"Inf\" value is NaN when multiplied by zero.\n\n  Args:\n    dtype: A dtype. The returned value will be finite when casted to this dtype.\n\n  Returns:\n    A very large value.\n  \"\"\"\n  if dtype == \"float32\" or dtype == \"bfloat16\":\n    return 1e7\n  elif dtype == \"float16\":\n    # Disable no-member lint error, as the linter thinks np.float16 does not\n    # exist for some reason.\n    return np.finfo(np.float16).max  # pylint: disable=no-member\n  else:\n    raise AssertionError(\"Invalid dtype: %s\" % dtype)\n\n\nclass _StateKeys(object):\n  \"\"\"Keys to dictionary storing the state of the beam search loop.\"\"\"\n\n  # Variable storing the loop index.\n  CUR_INDEX = \"CUR_INDEX\"\n\n  # Top sequences that are alive for each batch item. Alive sequences are ones\n  # that have not generated an EOS token. Sequences that reach EOS are marked as\n  # finished and moved to the FINISHED_SEQ tensor.\n  # Has shape [batch_size, beam_size, CUR_INDEX + 1]\n  ALIVE_SEQ = \"ALIVE_SEQ\"\n  # Log probabilities of each alive sequence. Shape [batch_size, beam_size]\n  ALIVE_LOG_PROBS = \"ALIVE_LOG_PROBS\"\n  # Dictionary of cached values for each alive sequence. The cache stores\n  # the encoder output, attention bias, and the decoder attention output from\n  # the previous iteration.","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/ops/beam_search.py#L22-L58","documentation":"Error \"Invalid dtype: %s\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/ops/beam_search.py:40 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"}