{"record":{"id":"4de1447165e5ac39","repo":"keras-team/keras","slug":"when-providing-the-input-tensor-argument-you-ca-4de144","errorCode":null,"errorMessage":"When providing the `input_tensor` argument, you cannot provide an incompatible `shape` argument.","messagePattern":"When providing the `input_tensor` argument, you cannot provide an incompatible `shape` argument\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/core/input_layer.py","lineNumber":55,"sourceCode":"                    \"Argument `input_tensor` must be a KerasTensor. \"\n                    f\"Received invalid type: input_tensor={input_tensor} \"\n                    f\"(of type {type(input_tensor)})\"\n                )\n            if batch_size is not None:\n                if (\n                    len(input_tensor.shape) < 1\n                    or input_tensor.shape[0] != batch_size\n                ):\n                    raise ValueError(\n                        \"When providing the `input_tensor` argument, you \"\n                        \"cannot provide an incompatible `batch_size` argument.\"\n                    )\n            if shape is not None:\n                if (\n                    len(shape) != len(input_tensor.shape) - 1\n                    or shape != input_tensor.shape[1:]\n                ):\n                    raise ValueError(\n                        \"When providing the `input_tensor` argument, you \"\n                        \"cannot provide an incompatible `shape` argument.\"\n                    )\n            if batch_shape is not None and batch_shape != input_tensor.shape:\n                raise ValueError(\n                    \"When providing the `input_tensor` argument, you \"\n                    \"cannot provide an incompatible `batch_shape` argument.\"\n                )\n            if dtype is not None and input_tensor.dtype != dtype:\n                raise ValueError(\n                    \"When providing the `input_tensor` argument, you \"\n                    \"cannot provide an incompatible `dtype` argument.\"\n                )\n            if sparse is not None and input_tensor.sparse != sparse:\n                raise ValueError(\n                    \"When providing the `input_tensor` argument, you \"\n                    \"cannot provide an incompatible `sparse` argument.\"\n                )","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/core/input_layer.py#L37-L73","documentation":"Error \"When providing the `input_tensor` argument, you cannot provide an incompatible `shape` argument.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/core/input_layer.py:55 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"}