{"record":{"id":"ce75620acced1355","repo":"keras-team/keras","slug":"convert-to-numpy-failed-to-convert-the-tensor","errorCode":null,"errorMessage":"`convert_to_numpy` failed to convert the tensor.","messagePattern":"`convert_to_numpy` failed to convert the tensor\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/openvino/core.py","lineNumber":950,"sourceCode":"        # fall back to the slow path.\n        pass\n    try:\n        ov_result = x.output\n        casted_from_bool = False\n        if ov_result.get_element_type() == Type.boolean:\n            ov_result = ov_opset.convert(ov_result, Type.i32).output(0)\n            casted_from_bool = True\n        ov_model = Model(results=[ov_result], parameters=[])\n        ov_compiled_model = compile_model(\n            ov_model,\n            get_device(),\n            config={\"INFERENCE_PRECISION_HINT\": \"f32\"},\n        )\n        result = ov_compiled_model({})[0]\n        if casted_from_bool:\n            result = result.astype(bool)\n    except Exception as inner_exception:\n        raise RuntimeError(\n            \"`convert_to_numpy` failed to convert the tensor.\"\n        ) from inner_exception\n    data = np.array(result)\n    # Same byte-reinterpretation issue applies to inference results.\n    if x.dtype == \"bfloat16\" and data.dtype != ml_dtypes.bfloat16:\n        data = data.view(ml_dtypes.bfloat16)\n    return data\n\n\ndef is_tensor(x):\n    if isinstance(x, OpenVINOKerasTensor):\n        return True\n    if isinstance(x, ov.Tensor):\n        return True\n    return False\n\n\ndef shape(x):","sourceCodeStart":932,"sourceCodeEnd":968,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/openvino/core.py#L932-L968","documentation":"Error \"`convert_to_numpy` failed to convert the tensor.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/openvino/core.py:950 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"}