{"record":{"id":"e516186c648ebafd","repo":"keras-team/keras","slug":"shape-of-weights-must-be-consistent-with-shape-of","errorCode":null,"errorMessage":"Shape of weights must be consistent with shape of a along specified axis.","messagePattern":"Shape of weights must be consistent with shape of a along specified axis\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/openvino/numpy.py","lineNumber":851,"sourceCode":"            else x.get_partial_shape()\n        )\n        weights_shape = (\n            weights_keras.shape\n            if hasattr(weights_keras, \"shape\")\n            else weights.get_partial_shape()\n        )\n        if len(weights_shape) == 1 and len(x_shape) > 1:\n            if axis is None or (\n                isinstance(axis, (list, tuple)) and len(axis) != 1\n            ):\n                raise ValueError(\n                    \"Axis must be specified when shapes of a and weights \"\n                    \"differ.\"\n                )\n            axis_val = axis[0] if isinstance(axis, (list, tuple)) else axis\n            axis_val = canonicalize_axis(axis_val, len(x_shape))\n            if weights_shape[0] != x_shape[axis_val]:\n                raise ValueError(\n                    \"Shape of weights must be consistent with shape of a \"\n                    \"along specified axis.\"\n                )\n        elif x_shape != weights_shape:\n            if axis is None:\n                raise ValueError(\n                    \"Axis must be specified when shapes of a and weights \"\n                    \"differ.\"\n                )\n            raise ValueError(\n                \"Shape of weights must be consistent with shape of a \"\n                \"along specified axis.\"\n            )\n\n    if axis is None:\n        flatten_shape = ov_opset.constant([-1], Type.i32).output(0)\n        x = ov_opset.reshape(x, flatten_shape, False).output(0)\n        if weights is not None:","sourceCodeStart":833,"sourceCodeEnd":869,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/openvino/numpy.py#L833-L869","documentation":"Error \"Shape of weights must be consistent with shape of a along specified axis.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/openvino/numpy.py:851 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"}