Skip to content

Commit 9a3f338

Browse files
[OpenVINO backend] add __array__ method for OpenVINOKerasTenor by raising and error
1 parent be9b002 commit 9a3f338

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

keras/src/backend/openvino/core.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,13 @@ def __mod__(self, other):
479479
)
480480
return OpenVINOKerasTensor(ov_opset.mod(first, other).output(0))
481481

482+
def __array__(self):
483+
raise ValueError(
484+
"A OpenVINOKerasTensor is symbolic: it's a placeholder for a shape "
485+
"an a dtype. It doesn't have any actual numerical value. "
486+
"You cannot convert it to a NumPy array."
487+
)
488+
482489

483490
def ov_to_keras_type(ov_type):
484491
for _keras_type, _ov_type in OPENVINO_DTYPES.items():

0 commit comments

Comments
 (0)