{"record":{"id":"65fc052c470530a7","repo":"keras-team/keras","slug":"input-shape-1-must-equal-input-tensor-shape-2","errorCode":null,"errorMessage":"input_shape[1] must equal input_tensor.shape[2].  Received input_shape={input_shape}, input_tensor.shape={input_tensor.shape}","messagePattern":"input_shape\\[1\\] must equal input_tensor\\.shape\\[2\\]\\.  Received input_shape=(.+?), input_tensor\\.shape=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/applications/mobilenet_v3.py","lineNumber":216,"sourceCode":"                    \"input_tensor: \",\n                    input_tensor,\n                    \"is not type input_tensor.  \"\n                    f\"Received type(input_tensor)={type(input_tensor)}\",\n                )\n        if is_input_t_tensor:\n            if backend.image_data_format() == \"channels_first\":\n                if input_tensor.shape[1] != input_shape[1]:\n                    raise ValueError(\n                        \"When backend.image_data_format()=channels_first, \"\n                        \"input_shape[1] must equal \"\n                        \"input_tensor.shape[1].  Received \"\n                        f\"input_shape={input_shape}, \"\n                        \"input_tensor.shape=\"\n                        f\"{input_tensor.shape}\"\n                    )\n            else:\n                if input_tensor.shape[2] != input_shape[1]:\n                    raise ValueError(\n                        \"input_shape[1] must equal \"\n                        \"input_tensor.shape[2].  Received \"\n                        f\"input_shape={input_shape}, \"\n                        \"input_tensor.shape=\"\n                        f\"{input_tensor.shape}\"\n                    )\n        else:\n            raise ValueError(\n                \"input_tensor specified: \",\n                input_tensor,\n                \"is not a keras 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:","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/applications/mobilenet_v3.py#L198-L234","documentation":"MobileNetV3 builder in keras/src/applications/mobilenet_v3.py: under channels_last, when both input_shape and input_tensor are supplied, input_tensor.shape[2] must equal input_shape[1]. The guard fires when the declared shape and the tensor's actual width disagree, which would yield an inconsistent model graph.","triggerScenarios":"Thrown at keras/src/applications/mobilenet_v3.py:216 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set input_shape to match input_tensor.shape, e.g. (224, 224, 3) for a (None, 224, 224, 3) tensor","Provide only input_shape or only input_tensor and let the builder infer the other","Recreate the tensor via keras.Input(shape=input_shape)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}