[OpenVINO] Fix pad to accept float scalar constant_values#22691
[OpenVINO] Fix pad to accept float scalar constant_values#22691hertschuh merged 3 commits intokeras-team:masterfrom
Conversation
There was a problem hiding this comment.
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.
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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: