Repository navigation
Conversation
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.
Types of changes
Bug fix.
Motivation and context / Related issue
Related to #518.
wasserstein_1daccepts values with shape(n, ...), but passing more than one batch axis currently fails inquantile_function. Returning plans also fails for ordinary 1D inputs and for batches passed withrequire_sort=False.This flattens the batch axes for
searchsorted, then restores the indices to the input layout before gathering the quantiles. Weights shared across omitted batch axes are expanded along each missing axis. Plan construction uses one column per batch and only maps indices through a sorter when sorting was needed.The existing list of plans is kept. Multiple batch axes are flattened in row-major order; an unbatched input returns a list containing one plan. Plan rows and columns still refer to the original sample order. The generic backend
searchsortedmethods are unchanged, so this does not address every part of #518.How has this been tested (if it applies)
ot.emd; checked partially shared weights againstot.emd2for bothp=1andp=2.gradcheckand the JAX JIT comparison pass, including non-contiguous PyTorch inputs.git diff --checkpass.These were local CPU runs with POT's native extensions built from the checked-out source. The full test suite, documentation build, GPU execution, TensorFlow and CuPy were not tested.
PR checklist
The docstrings and release note are updated. The two unchecked items reflect the documentation build and full test suite not being run locally; the targeted results are listed above.