{"record":{"id":"f513d9ce88edf298","repo":"keras-team/keras","slug":"axis-must-be-specified-when-shapes-of-a-and-weight","errorCode":null,"errorMessage":"Axis must be specified when shapes of a and weights differ.","messagePattern":"Axis must be specified when shapes of a and weights differ\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/openvino/numpy.py","lineNumber":844,"sourceCode":"    if weights is not None:\n        weights = get_ov_output(weights)\n\n    if weights_keras is not None:\n        x_shape = (\n            x_keras.shape\n            if hasattr(x_keras, \"shape\")\n            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 \"","sourceCodeStart":826,"sourceCodeEnd":862,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/openvino/numpy.py#L826-L862","documentation":"Error \"Axis must be specified when shapes of a and weights differ.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/openvino/numpy.py:844 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"}