Repository navigation
[MRG] Fix JAX gradients for dense emd2 - #917
Open
gezerui888 wants to merge 2 commits into
Open
gezerui888 wants to merge 2 commits into
gezerui888 wants to merge 2 commits into
Conversation
Author
|
@rflamary I'd appreciate a review when you have time. Could you also approve the pending CI workflows? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #917 +/- ##
==========================================
+ Coverage 97.07% 97.09% +0.01%
==========================================
Files 130 130
Lines 27095 27229 +134
==========================================
+ Hits 26302 26437 +135
+ Misses 793 792 -1 🚀 New features to boost your workflow:
|
3 of 5 tasks
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
Addresses #625. This fixes the
emd2loss path discussed there; it does not change the transport-plan API or add nativejit/vmapsupport.jax.grad(ot.emd2)fails when traced inputs reach the native solver. I detach the solver inputs and keep the original arrays for gradient registration. I also replace the JAX gradient attachment so that it uses the supplied gradients at full magnitude and preserves their dependence for higher derivatives. This also corrects the JAX envelope gradients returned byot.solve.How has this been tested (if it applies)
I added 36 cases for marginal and cost gradients, finite differences, empty marginals, dtype and return options, upstream scaling, nested values, and higher derivatives.
pytest --durations=20 -v test/ --doctest-modules: 3,592 passed, 487 skipped, six xfailed. Base has 3,556 passed with the same skips and xfails.pre-commit run --all-files: passed.PR checklist
cc @rflamary