- Sinkhorn.output_from_state(ot_prob, state)#
Create an output from a loop state.
When differentiating the regularized OT cost, and assuming Sinkhorn has run to convergence, Danskin’s (or the envelope) theorem [Bertsekas, 1971, Danskin, 1967] states that the resulting OT cost as a function of the inputs (
b) behaves locally as if the dual optimal potentials were frozen and did not vary with those inputs.
Notice this is only valid, as when using
implicit_differentiationmode, if the Sinkhorn algorithm outputs potentials that are near optimal. namely when the threshold value is set to a small tolerance.
use_danskincontrols whether that assumption is made. By default, that flag is set to the value of
implicit_differentiationif not specified. If you wish to compute derivatives of order 2 and above, set