Implement nanmedian function in keras.ops#22585
Implement nanmedian function in keras.ops#22585shashaka wants to merge 6 commits intokeras-team:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the nanmedian operation across multiple Keras backends (JAX, TensorFlow, PyTorch, and NumPy) and adds the corresponding public API and tests. Feedback focuses on ensuring consistent behavior for edge cases, specifically handling empty axis reductions in the NumPy backend to prevent ValueError and removing a redundant check in the PyTorch implementation. A test assertion also needs to be updated to correctly verify the identity behavior for empty axes.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #22585 +/- ##
==========================================
- Coverage 83.28% 79.85% -3.44%
==========================================
Files 596 596
Lines 68089 68125 +36
Branches 10607 10610 +3
==========================================
- Hits 56711 54401 -2310
- Misses 8634 11020 +2386
+ Partials 2744 2704 -40
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:
|
hertschuh
left a comment
There was a problem hiding this comment.
Thanks for adding this!
Can you also rebase?
Adds keras.ops.nanmedian, which computes the median of the input tensor along a specified axis while ignoring NaN values.
Supported across NumPy, TensorFlow, PyTorch, and JAX backends. Not supported on OpenVINO.