{"record":{"id":"92222e7ea824a3e0","repo":"tensorflow/models","slug":"got-mismatched-input-and-output-state-shapes","errorCode":null,"errorMessage":"Got mismatched input and output state shapes: {}","messagePattern":"Got mismatched input and output state shapes: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/movinet/modeling/movinet_model.py","lineNumber":142,"sourceCode":"      new_states = set(after_states) - set(before_states)\n      if new_states:\n        raise ValueError(\n            'Expected input and output states to be the same. Got extra states '\n            '{}, expected {}'.format(new_states, set(before_states)))\n\n      mismatched_shapes = {}\n      for name in after_states:\n        before_shape = before_states[name].shape\n        after_shape = after_states[name].shape\n        if len(before_shape) != len(after_shape):\n          mismatched_shapes[name] = (before_shape, after_shape)\n          continue\n        for before, after in zip(before_shape, after_shape):\n          if before is not None and after is not None and before != after:\n            mismatched_shapes[name] = (before_shape, after_shape)\n            break\n      if mismatched_shapes:\n        raise ValueError(\n            'Got mismatched input and output state shapes: {}'.format(\n                mismatched_shapes))\n    else:\n      endpoints, states = backbone(inputs)\n    return inputs, endpoints, states\n\n  def _build_network(\n      self,\n      backbone: tf_keras.Model,\n      input_specs: Mapping[str, tf_keras.layers.InputSpec],\n      state_specs: Optional[Mapping[str, tf_keras.layers.InputSpec]] = None,\n  ) -> Tuple[Mapping[str, tf_keras.Input], Union[Tuple[Mapping[  # pytype: disable=invalid-annotation  # typed-keras\n      str, tf.Tensor], Mapping[str, tf.Tensor]], Mapping[str, tf.Tensor]]]:\n    \"\"\"Builds the model network.\n\n    Args:\n      backbone: the model backbone.\n      input_specs: the model input spec to use.","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/movinet/modeling/movinet_model.py#L124-L160","documentation":"Error \"Got mismatched input and output state shapes: {}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/movinet/modeling/movinet_model.py:142 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"}