{"record":{"id":"d60b242a84a07b6b","repo":"keras-team/keras","slug":"input-tensor-is-not-a-keras-tensor-received-inpu","errorCode":null,"errorMessage":"input_tensor is not a Keras tensor; Received `input_tensor={input_tensor}`","messagePattern":"input_tensor is not a Keras tensor; Received `input_tensor=(.+?)`","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/applications/mobilenet_v2.py","lineNumber":162,"sourceCode":"            if backend.image_data_format() == \"channels_first\":\n                if input_tensor.shape[1] != input_shape[1]:\n                    raise ValueError(\n                        \"input_shape[1] must equal shape(input_tensor)[1] \"\n                        \"when `image_data_format` is `channels_first`; \"\n                        \"Received `input_tensor.shape=\"\n                        f\"{input_tensor.shape}`\"\n                        f\", `input_shape={input_shape}`\"\n                    )\n            else:\n                if input_tensor.shape[2] != input_shape[1]:\n                    raise ValueError(\n                        \"input_tensor.shape[2] must equal input_shape[1]; \"\n                        \"Received `input_tensor.shape=\"\n                        f\"{input_tensor.shape}`, \"\n                        f\"`input_shape={input_shape}`\"\n                    )\n        else:\n            raise ValueError(\n                \"input_tensor is not a Keras tensor; \"\n                f\"Received `input_tensor={input_tensor}`\"\n            )\n\n    # If input_shape is None, infer shape from input_tensor.\n    if input_shape is None and input_tensor is not None:\n        try:\n            backend.is_keras_tensor(input_tensor)\n        except ValueError:\n            raise ValueError(\n                \"input_tensor must be a valid Keras tensor type; \"\n                f\"Received {input_tensor} of type {type(input_tensor)}\"\n            )\n\n        if input_shape is None and not backend.is_keras_tensor(input_tensor):\n            default_size = 224\n        elif input_shape is None and backend.is_keras_tensor(input_tensor):\n            if backend.image_data_format() == \"channels_first\":","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/applications/mobilenet_v2.py#L144-L180","documentation":"Error \"input_tensor is not a Keras tensor; Received `input_tensor={input_tensor}`\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/applications/mobilenet_v2.py:162 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"}