Skip to content

Commit 2336655

Browse files
update a small feature in __getitem__ for openvino backend
1 parent be9b002 commit 2336655

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

keras/src/backend/openvino/core.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,13 @@ def count_unsqueeze_before(dim):
341341
raise ValueError(
342342
"OpenVINO backend does not support boolean indexing"
343343
)
344-
elif isinstance(index, (int, np.integer)):
345-
if isinstance(index, np.integer):
344+
elif isinstance(index, (int, np.integer, np.ndarray)):
345+
if isinstance(index, (np.ndarray, np.integer)):
346+
if isinstance(index, np.ndarray):
347+
assert len(index.shape) == 0, (
348+
"OpenVINO backend does not "
349+
"support multi-dimensional indexing"
350+
)
346351
index = int(index)
347352
actual_dim = dim - count_unsqueeze_before(dim)
348353
if not (0 <= actual_dim < rank):

0 commit comments

Comments
 (0)