Skip to content

Commit fbb42aa

Browse files
authored
[OpenVINO backend] Update ndim behavior (#21317)
* Change ndims behavior * Remove openvino.runtime * Switch to double ShapeOf * Reorder imports in core.py * Remove runtime changes
1 parent 376225f commit fbb42aa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

keras/src/backend/openvino/numpy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,9 +1177,9 @@ def nan_to_num(x, nan=0.0, posinf=None, neginf=None):
11771177

11781178
def ndim(x):
11791179
x = get_ov_output(x)
1180-
x_shape = ov_opset.shape_of(x).output(0)
1181-
x_dim = ov_opset.shape_of(x_shape, "i64")
1182-
return x_dim
1180+
shape_tensor = ov_opset.shape_of(x, Type.i64).output(0)
1181+
rank_tensor = ov_opset.shape_of(shape_tensor, Type.i64).output(0)
1182+
return OpenVINOKerasTensor(rank_tensor)
11831183

11841184

11851185
def nonzero(x):

0 commit comments

Comments
 (0)