{"record":{"id":"87610939f19e7c45","repo":"keras-team/keras","slug":"input-tensors-must-have-the-same-structure-as-mo","errorCode":null,"errorMessage":"`input_tensors` must have the same structure as model.input\\nReference structure: {model.input}\\nReceived structure: {input_tensors}","messagePattern":"`input_tensors` must have the same structure as model\\.input\\\\nReference structure: (.+?)\\\\nReceived structure: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/models/cloning.py","lineNumber":392,"sourceCode":"    if not isinstance(model, Functional):\n        raise ValueError(\n            \"Expected `model` argument \"\n            f\"to be a Functional Model instance. Received: model={model}\"\n        )\n\n    if input_tensors is not None:\n        if not all(\n            isinstance(x, backend.KerasTensor)\n            for x in tree.flatten(input_tensors)\n        ):\n            raise ValueError(\n                \"All entries in `input_tensors` must be KerasTensors. \"\n                f\"Received invalid values: inputs_tensors={input_tensors}\"\n            )\n        try:\n            tree.assert_same_structure(input_tensors, model.input)\n        except ValueError as e:\n            raise ValueError(\n                \"`input_tensors` must have the same structure as model.input\"\n                f\"\\nReference structure: {model.input}\"\n                f\"\\nReceived structure: {input_tensors}\"\n            ) from e\n    else:\n        input_tensors = tree.map_structure(\n            lambda x: Input(batch_shape=x.shape, dtype=x.dtype, name=x.name),\n            model.input,\n        )\n\n    def operation_fn(layer):\n        new_layer = clone_function(layer)\n        return new_layer\n\n    output_tensors = model._run_through_graph(\n        input_tensors,\n        operation_fn=operation_fn,\n        call_fn=call_function,","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/models/cloning.py#L374-L410","documentation":"Error \"`input_tensors` must have the same structure as model.input\\nReference structure: {model.input}\\nReceived structure: {input_tensors}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/models/cloning.py:392 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":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}