Skip to content

[OpenVINO Backend]: support numpy.ndim #21176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion keras/src/backend/openvino/excluded_concrete_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ NumpyOneInputOpsCorrectnessTest::test_meshgrid
NumpyOneInputOpsCorrectnessTest::test_min
NumpyOneInputOpsCorrectnessTest::test_moveaxis
NumpyOneInputOpsCorrectnessTest::test_nan_to_num
NumpyOneInputOpsCorrectnessTest::test_ndim
NumpyOneInputOpsCorrectnessTest::test_nonzero
NumpyOneInputOpsCorrectnessTest::test_pad_float16_constant_2
NumpyOneInputOpsCorrectnessTest::test_pad_float32_constant_2
Expand Down
5 changes: 4 additions & 1 deletion keras/src/backend/openvino/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,10 @@ def nan_to_num(x, nan=0.0, posinf=None, neginf=None):


def ndim(x):
raise NotImplementedError("`ndim` is not supported with openvino backend")
x = get_ov_output(x)
x_shape = ov_opset.shape_of(x).output(0)
x_dim = ov_opset.shape_of(x_shape, "i64")
return x_dim


def nonzero(x):
Expand Down