{"record":{"id":"8bef6d3b57ddc900","repo":"tensorflow/models","slug":"the-call-method-expects-either-inputs-or-embedd","errorCode":null,"errorMessage":"The call method expects either `inputs` or `embedded_inputs` and `input_masks` as input features.","messagePattern":"The call method expects either `inputs` or `embedded_inputs` and `input_masks` as input features\\.","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/models/seq2seq_transformer.py","lineNumber":143,"sourceCode":"\n  def _parse_inputs(self, inputs):\n    \"\"\"Parses the `call` inputs and returns an uniformed output.\"\"\"\n    sources = inputs.get(\"inputs\", None)\n    input_mask = inputs.get(\"input_masks\", None)\n    embedded = inputs.get(\"embedded_inputs\", None)\n\n    if sources is None and embedded is not None:\n      embedded_inputs = embedded\n      boolean_mask = input_mask\n      input_shape = tf_utils.get_shape_list(embedded, expected_rank=3)\n      source_dtype = embedded.dtype\n    elif sources is not None:\n      embedded_inputs = self.embedding_lookup(sources)\n      boolean_mask = tf.not_equal(sources, 0)\n      input_shape = tf_utils.get_shape_list(sources, expected_rank=2)\n      source_dtype = sources.dtype\n    else:\n      raise KeyError(\n          \"The call method expects either `inputs` or `embedded_inputs` and \"\n          \"`input_masks` as input features.\")\n\n    return embedded_inputs, boolean_mask, input_shape, source_dtype\n\n  def call(self, inputs):  # pytype: disable=signature-mismatch  # overriding-parameter-count-checks\n    \"\"\"Calculate target logits or inferred target sequences.\n\n    Args:\n      inputs: a dictionary of tensors.\n        Feature `inputs` (optional): int tensor with shape\n          `[batch_size, input_length]`.\n        Feature `embedded_inputs` (optional): float tensor with shape\n          `[batch_size, input_length, embedding_width]`.\n        Feature `targets` (optional): None or int tensor with shape\n          `[batch_size, target_length]`.\n        Feature `input_masks` (optional): When providing the `embedded_inputs`,\n          the dictionary must provide a boolean mask marking the filled time","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/models/seq2seq_transformer.py#L125-L161","documentation":"Error \"The call method expects either `inputs` or `embedded_inputs` and `input_masks` as input features.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/models/seq2seq_transformer.py:143 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"}