Skip to content

Fix(OpenVINO): Ensure numpy.prod passes tests and handles boolean inp… #21403

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 5 commits into
base: master
Choose a base branch
from

Conversation

Mezalfa
Copy link

@Mezalfa Mezalfa commented Jun 18, 2025

This pull request implements keras.numpy.prod for the OpenVINO backend.

Features:
Handles reduction along specified axes, including single integers, tuples, and None.
Implements promotion for dtype when dtype is passed as None ,converting to a suitable OpenVINO type.
If dtype is specified, the output is converted to the specified dtype.
Properly manages the keepdims argument to retain or drop the reduced dimensions in the output shape.

@codecov-commenter
Copy link

codecov-commenter commented Jun 18, 2025

Codecov Report

Attention: Patch coverage is 88.88889% with 3 lines in your changes missing coverage. Please review.

Project coverage is 82.67%. Comparing base (9205298) to head (568c2e0).
Report is 23 commits behind head on master.

Files with missing lines Patch % Lines
keras/src/backend/openvino/numpy.py 88.88% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #21403   +/-   ##
=======================================
  Coverage   82.67%   82.67%           
=======================================
  Files         565      565           
  Lines       55073    55100   +27     
  Branches     8571     8578    +7     
=======================================
+ Hits        45532    45556   +24     
- Misses       7443     7445    +2     
- Partials     2098     2099    +1     
Flag Coverage Δ
keras 82.48% <88.88%> (+<0.01%) ⬆️
keras-jax 63.47% <0.00%> (-0.04%) ⬇️
keras-numpy 58.65% <0.00%> (-0.03%) ⬇️
keras-openvino 33.50% <88.88%> (+0.04%) ⬆️
keras-tensorflow 63.88% <0.00%> (-0.04%) ⬇️
keras-torch 63.50% <0.00%> (-0.04%) ⬇️

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.

@Mezalfa
Copy link
Author

Mezalfa commented Jun 19, 2025

@rkazants

.gitignore Outdated
Comment on lines 21 to 23
.ruff_cache No newline at end of file
.ruff_cache
my_clean_keras_env_py310/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert these changes

Comment on lines 1281 to 1294
promotion_map = {
Type.bf16: Type.bf16,
Type.f16: Type.f16,
Type.f32: Type.f32,
Type.f64: Type.f64,
Type.i8: Type.i32,
Type.i16: Type.i32,
Type.i32: Type.i32,
Type.i64: Type.i64,
Type.u8: Type.u32,
Type.u16: Type.u32,
Type.u32: Type.u32,
Type.u64: Type.u64,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use the same dictionary from core.py


temporary_result = ov_opset.reduce_prod(x, axis, keepdims).output(0)
Copy link
Contributor

@rkazants rkazants Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name this var prod_result

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