Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (66.17%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #6219 +/- ##
=======================================
Coverage 66.17% 66.17%
=======================================
Files 878 878
Lines 127748 127748
=======================================
Hits 84541 84541
Misses 43207 43207 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Avoid the full stacked-neighborhood tensor on Flex CPU. Use a SIMD selection
network for 3×3 windows, sliding histograms for U8/I8 and eligible normalized RGB8
inputs, and reusable-buffer partial selection for other windows.
Support F16, BF16, F32, F64, and signed/unsigned 8/16/32/64-bit integers.
Floating-point autodiff selects source indices and gathers from the original
tensor, preserving tie routing and replicated-border gradients. Other backends
and quantized inputs retain the existing tensor decomposition.
Integer inputs are newly supported. Float constructors may need
Tensor::<4>where the old API inferred their kind.
Benchmarks
The baseline reproduces the previous edge-pad → stack → full-sort → slice
algorithm. Integer rows apply that algorithm to integer tensors; the previous
public median-blur API accepted only floating-point tensors.
Forward inputs:
[1, 3, 128, 128]; forward + backward:[1, 3, 64, 64].Backward measures median → sum → backward, including gradient retrieval.
Inputs are pseudorandom floats in
[0, 1], unsigned integers in[0, 255],or signed integers in
[-128, 127], converted to the requested dtype.Measurements use the dependency versions from upstream base
3da5d2a3c.Intel i5-12400F, Rust 1.98.0, release build, one pinned CPU core,
RAYON_NUM_THREADS=1. Times are medians of five alternating-order samples,each lasting at least 70 ms after warmup. Timed calls read back and checksum
outputs or gradients; correctness is checked before timing.
These measurements cover CPU median filtering, not end-to-end model performance.
Correctness
Forward outputs matched the old algorithm bit-for-bit in regression and benchmark
fixtures across all 12 supported native dtypes. Regression coverage includes
noncontiguous views, replicated borders, even windows, NaNs, and signed zeros.
The optimization introduces no additional quantization or approximate median selection.
Backward gradients matched the tested cases, including ties and replicated borders.
Floating-point accumulation order can change, so other inputs may exhibit small
rounding differences.
Testing
cargo run-checks: passed; 4,346 tests passed and 39 ignored.Related Issues/PRs
Fixes #6218.
Background: Mikyx-1/burn#398.
AI Usage
Codex carried out most implementation, testing, documentation, validation, and
benchmarking autonomously under user direction. Codex also wrote this description
and created the GitHub issue and PR.
Checklist
cargo run-checkshas been executed.