Repository navigation
Conversation
Use the maximum absolute error within each batch and across metric states when p is infinite. The finite-order power sum gives a final exponent of zero at infinity, even when the inputs are identical. Compare both APIs with SciPy on identical inputs and uneven batches.
WeiLiuu
requested review from
SkafteNicki,
ethanwharris,
justusperillieux and
tchaton
as code owners
November 28, 2026 04:38
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3681 +/- ##
=======================================
- Coverage 37% 35% -1%
=======================================
Files 349 357 +8
Lines 19901 20294 +393
=======================================
- Hits 7264 7201 -63
- Misses 12637 13093 +456 🚀 New features to boost your workflow:
|
atishay-kasliwal
left a comment
There was a problem hiding this comment.
Compared minkowski_distance and MinkowskiDistance (two batches) with scipy for p = 1, 2, 3.5 and inf. p=inf now gives 2.71469, the same as scipy.spatial.distance.chebyshev; master returned 1.0. The finite orders are unchanged and match scipy...minkowski.
This branch has not been deployed
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.
What does this PR do?
Fixes #3680
For
p=float("inf"), the final exponent was zero, so even identical inputs had a distance of 1. Take the maximum absolute difference and use the same maximum when combining batches or distributed states. Finite orders still accumulate the sum of powers.The tests compare both APIs to SciPy, including identical inputs and an uneven split where the largest error is in the first batch. All 46 CPU tests in the Minkowski module passed. A two-process Gloo run also matched SciPy on both ranks.
AI use: Claude and Codex did most of the work, the patch and the test, and drafted this text.
Before submitting