{"record":{"id":"c90325d285cceaff","repo":"keras-team/keras","slug":"argument-constant-values-can-only-be-provided-wh-c90325","errorCode":null,"errorMessage":"Argument `constant_values` can only be provided when `mode == 'constant'`. Received: mode={mode}","messagePattern":"Argument `constant_values` can only be provided when `mode == 'constant'`\\. Received: mode=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/openvino/numpy.py","lineNumber":3871,"sourceCode":"\n    new_shape_x1 = ov_opset.constant([-1, 1], Type.i32).output(0)\n    new_shape_x2 = ov_opset.constant([1, -1], Type.i32).output(0)\n\n    # Reshape directly from original tensors\n    x1_reshaped = ov_opset.reshape(x1, new_shape_x1, False).output(0)\n    x2_reshaped = ov_opset.reshape(x2, new_shape_x2, False).output(0)\n\n    result = ov_opset.multiply(x1_reshaped, x2_reshaped).output(0)\n\n    return OpenVINOKerasTensor(result)\n\n\ndef pad(x, pad_width, mode=\"constant\", constant_values=None):\n    x = get_ov_output(x)\n    pad_value = None\n    if constant_values is not None:\n        if mode != \"constant\":\n            raise ValueError(\n                \"Argument `constant_values` can only be \"\n                \"provided when `mode == 'constant'`. \"\n                f\"Received: mode={mode}\"\n            )\n        if not isinstance(\n            constant_values, (int, float, np.integer, np.floating)\n        ):\n            raise ValueError(\n                \"`pad` operation supports only scalar pad value \"\n                \"in constant mode with the openvino backend. \"\n                f\"Received: constant_values={constant_values}\"\n            )\n        pad_value = ov_opset.constant(\n            constant_values, x.get_element_type()\n        ).output(0)\n\n    # split pad_width into two tensors pads_begin and pads_end\n    pads_begin = []","sourceCodeStart":3853,"sourceCodeEnd":3889,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/openvino/numpy.py#L3853-L3889","documentation":"Error \"Argument `constant_values` can only be provided when `mode == 'constant'`. Received: mode={mode}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/openvino/numpy.py:3871 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"}