Skip to content

[OpenVINO] Fix pad to accept float scalar constant_values#22691

Merged
hertschuh merged 3 commits intokeras-team:masterfrom
goyaladitya05:openvino/pad
Apr 20, 2026
Merged

[OpenVINO] Fix pad to accept float scalar constant_values#22691
hertschuh merged 3 commits intokeras-team:masterfrom
goyaladitya05:openvino/pad

Conversation

@goyaladitya05
Copy link
Copy Markdown
Contributor

Description

The ov pad was rejecting any non-int constant_values with a ValueError, but float scalars (e.g. 0.0) are equally valid. This caused compute_quantization_parameters and abs_max_quantize_grouped_with_zero_point to fail when padding inputs whose dimension isn't divisible by block_size.

Widened the isinstance check from int to (int, float).
Removed the relevent tests from exclusion lists.

Contributor Agreement

Please check all boxes below before submitting your PR for review:

  • I am a human, and not a bot.
  • I will be responsible for responding to review comments in a timely manner.
  • I will work with the maintainers to push this PR forward until submission.

Note: Failing to adhere to this agreement may result in your future PRs no longer being reviewed.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enables previously excluded tests for the OpenVINO backend and updates the pad operation in keras/src/backend/openvino/numpy.py to support float constant values. Feedback was provided to further expand the type validation for constant_values to include NumPy scalar types, ensuring compatibility with common Keras data types and preventing unnecessary errors.

Comment thread keras/src/backend/openvino/numpy.py Outdated
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 17, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.95%. Comparing base (d51c980) to head (7e926ae).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
keras/src/backend/openvino/numpy.py 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #22691      +/-   ##
==========================================
+ Coverage   82.94%   82.95%   +0.01%     
==========================================
  Files         596      596              
  Lines       69200    69252      +52     
  Branches    10806    10814       +8     
==========================================
+ Hits        57399    57451      +52     
  Misses       8973     8973              
  Partials     2828     2828              
Flag Coverage Δ
keras 82.77% <0.00%> (+0.01%) ⬆️
keras-jax 58.72% <0.00%> (-0.04%) ⬇️
keras-numpy 54.56% <0.00%> (-0.04%) ⬇️
keras-openvino 59.43% <0.00%> (+0.04%) ⬆️
keras-tensorflow 60.28% <0.00%> (-0.04%) ⬇️
keras-torch 59.05% <0.00%> (-0.05%) ⬇️

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.

Copy link
Copy Markdown
Collaborator

@hertschuh hertschuh left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@google-ml-butler google-ml-butler Bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Apr 20, 2026
@hertschuh hertschuh merged commit f85ccfd into keras-team:master Apr 20, 2026
9 checks passed
@goyaladitya05 goyaladitya05 deleted the openvino/pad branch May 1, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kokoro:force-run ready to pull Ready to be merged into the codebase size:XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants