Skip to content

Auto-diff for Optimal Transport #356

Answered by rflamary
HowardZJU asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

For exact OT the plan itself is not differentiable wrt the input but be have the gradient wrt the masses as a result of solving the problem (hence the need to use emd2 because the gradient is properly defined in the function). In emd the ot plan is detached from the input so if you recompute the loss it will be only wrt the distance matrix, not the masses.

The unbalanced problems are smooth and we only use differentiable operation in the algorithm so you can use autodiff to compute the gradients wrt all the inputs. the plan is not detached for those functions so you can recompute the loss and the gradient will back-propagate.

EDIT: more precisely unbalanced solvers are not differen…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@HowardZJU
Comment options

@HowardZJU
Comment options

@rflamary
Comment options

@HowardZJU
Comment options

Answer selected by HowardZJU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants