Skip to content

[OpenVINO backend] Update ndim behavior #21317

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

p-wysocki
Copy link

@p-wysocki p-wysocki commented May 22, 2025

The current implementation uses API which is deprecated and set up for removal in the upcoming releases. This PR updates ndim function to use the recommended API.

The change is tested by:

def test_ndim(self):
x = KerasTensor((None, 3))
self.assertEqual(knp.ndim(x).shape, (2,))

Additionally, import openvino.runtime is deprecated and it's recommended to replace it with import openvino.

Copy link

google-cla bot commented May 22, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@codecov-commenter
Copy link

codecov-commenter commented May 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.60%. Comparing base (785c9b0) to head (1b4162c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21317      +/-   ##
==========================================
- Coverage   82.60%   82.60%   -0.01%     
==========================================
  Files         565      565              
  Lines       54773    54771       -2     
  Branches     8508     8508              
==========================================
- Hits        45244    45242       -2     
  Misses       7439     7439              
  Partials     2090     2090              
Flag Coverage Δ
keras 82.41% <100.00%> (-0.01%) ⬇️
keras-jax 63.56% <0.00%> (+<0.01%) ⬆️
keras-numpy 58.71% <0.00%> (+<0.01%) ⬆️
keras-openvino 33.12% <100.00%> (-0.01%) ⬇️
keras-tensorflow 63.96% <0.00%> (+<0.01%) ⬆️
keras-torch 63.62% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mlukasze
Copy link

Info for reviewers - author of PR is one of maintaners for OpenVINO python API.
He knows what he is doing.

@p-wysocki
Copy link
Author

p-wysocki commented May 22, 2025

The CI is failing with pre-commit check api-gen, but there's no explicit error message. I ran the generation script as instructed in https://github.com/keras-team/keras?tab=readme-ov-file#minimal-installation with .shell/api_gen.sh, but it updated ~130 files with changes which are irrelevant, for example:

diff --git a/keras/api/optimizers/__init__.py b/keras/api/optimizers/__init__.py
index 40f6ab401..4114fab5b 100644
--- a/keras/api/optimizers/__init__.py
+++ b/keras/api/optimizers/__init__.py
@@ -4,6 +4,7 @@ This file was autogenerated. Do not edit it by hand,
 since your modifications would be overwritten.
 """

+
 from keras.optimizers import legacy as legacy
 from keras.optimizers import schedules as schedules
 from keras.src.optimizers import deserialize as deserialize
@@ -18,9 +19,7 @@ from keras.src.optimizers.adamw import AdamW as AdamW
 from keras.src.optimizers.ftrl import Ftrl as Ftrl
 from keras.src.optimizers.lamb import Lamb as Lamb
 from keras.src.optimizers.lion import Lion as Lion
-from keras.src.optimizers.loss_scale_optimizer import (
-    LossScaleOptimizer as LossScaleOptimizer,
-)
+from keras.src.optimizers.loss_scale_optimizer import LossScaleOptimizer as LossScaleOptimizer
 from keras.src.optimizers.muon import Muon as Muon

Is this expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants