keras icon indicating copy to clipboard operation
keras copied to clipboard

[OpenVINO backend] Update `ndim` behavior

Open p-wysocki opened this issue 6 months ago • 8 comments

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: https://github.com/keras-team/keras/blob/785c9b0b59be9d7921f48562998d4b0257e24ee9/keras/src/ops/numpy_test.py#L1527-L1529

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

p-wysocki avatar May 22 '25 11:05 p-wysocki

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.

google-cla[bot] avatar May 22 '25 11:05 google-cla[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 82.73%. Comparing base (3d6022a) to head (b504517). :warning: Report is 189 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #21317   +/-   ##
=======================================
  Coverage   82.72%   82.73%           
=======================================
  Files         565      565           
  Lines       55222    55222           
  Branches     8609     8609           
=======================================
+ Hits        45683    45687    +4     
+ Misses       7428     7424    -4     
  Partials     2111     2111           
Flag Coverage Δ
keras 82.54% <100.00%> (+<0.01%) :arrow_up:
keras-jax 63.33% <0.00%> (ø)
keras-numpy 58.53% <0.00%> (+<0.01%) :arrow_up:
keras-openvino 33.80% <100.00%> (+<0.01%) :arrow_up:
keras-tensorflow 63.74% <0.00%> (ø)
keras-torch 63.37% <0.00%> (ø)

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov-commenter avatar May 22 '25 12:05 codecov-commenter

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

mlukasze avatar May 22 '25 12:05 mlukasze

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?

p-wysocki avatar May 22 '25 12:05 p-wysocki

bump @gbaned, @mattdangerw

p-wysocki avatar Jun 02 '25 07:06 p-wysocki

bump @gbaned, @mattdangerw

p-wysocki avatar Jun 11 '25 09:06 p-wysocki

@p-wysocki, please fix CI issue

rkazants avatar Jun 11 '25 13:06 rkazants

@rkazants the red CI check remains a question to maintainers at https://github.com/keras-team/keras/pull/21317#issuecomment-2901063989

p-wysocki avatar Jun 11 '25 14:06 p-wysocki

bump @gbaned, @mattdangerw could you please take a look if ~130 files changed by ./shell/api_gen.sh is expected?

p-wysocki avatar Jun 24 '25 12:06 p-wysocki

I moved the openvino.runtime changes to https://github.com/keras-team/keras/pull/21418 in order to unblock https://github.com/openvinotoolkit/openvino/pull/30636.

p-wysocki avatar Jun 24 '25 13:06 p-wysocki

bump @fchollet

p-wysocki avatar Jun 30 '25 11:06 p-wysocki