Skip to content

[WIP] Torch implementations (exact OT + Sinkhorn + 1D + sliced)#216

Closed
rflamary wants to merge 26 commits into
masterfrom
torch
Closed

[WIP] Torch implementations (exact OT + Sinkhorn + 1D + sliced)#216
rflamary wants to merge 26 commits into
masterfrom
torch

Conversation

@rflamary

@rflamary rflamary commented Nov 10, 2020

Copy link
Copy Markdown
Collaborator

Types of changes

  • New feature (non-breaking change which adds functionality)

What is planned in this PR:

  • LP and sinkhorn solvers (takes and return optionally detached torch tensors)
  • LP and Sinkhorn loss/divergence functions that are differentiable wrt the weights and distance matrix
  • ot.torch.utils torch utils functions for quick prototyping (dist, unif, proj_simplex)
  • Proper documentation and examples

Motivation and context / Related issue

Add a torch compatible functions for computing OT and OT loss for exact and sinkhorn divergences.

How has this been tested (if it applies)

Checklist

  • The documentation is up-to-date with the changes I made.
  • I have read the CONTRIBUTING document.
  • All tests passed, and additional code has been covered with new tests.

@codecov

codecov Bot commented Nov 10, 2020

Copy link
Copy Markdown

Codecov Report

Merging #216 (0891d35) into master (d06eee8) will increase coverage by 0.09%.
The diff coverage is 94.69%.

@@            Coverage Diff             @@
##           master     #216      +/-   ##
==========================================
+ Coverage   92.10%   92.20%   +0.09%     
==========================================
  Files          16       19       +3     
  Lines        3054     3167     +113     
==========================================
+ Hits         2813     2920     +107     
- Misses        241      247       +6     

@AdrienCorenflos

Copy link
Copy Markdown
Contributor

Hi,
I also have this code that I can contribute (opened a draft PR for it)
#218
Let me know if you want me to iron it out or if you have other plans.
Adrien

@AdrienCorenflos

Copy link
Copy Markdown
Contributor

Hi,
I just checked because of some jitting issues I was having, but pytorch doesn't officially support Python 3.5, so might be case for you to drop the support in POT too?

rflamary and others added 3 commits December 1, 2020 14:18
* small tentative for EMD 1D

* Implemented the vectorized version of the EMD 1D following the discussions

* Update build_tests.yml

Remove py3.5 from supported version and add 3.9 instead

* Update build_tests.yml

CVXOPT doesn't support 3.9

* change name add example and reference

* Changed order of batching, it was more complicated than expected as pytorch doesn't allow for a bunch of operations to be taken along a certain dimension (searchsorted, etc...)

* fixed doctest

* Modified require_sort docstring
@rflamary rflamary changed the title [WIP] Torch implementations (exact OT + Sinkhorn) [WIP] Torch implementations (exact OT + Sinkhorn + 1D + sliced) Jan 6, 2021
@rflamary

rflamary commented Sep 6, 2021

Copy link
Copy Markdown
Collaborator Author

This PR has been replaced by #249

@rflamary rflamary closed this Sep 6, 2021
@rflamary rflamary deleted the torch branch January 14, 2022 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants