Skip to content

Commit e1ef07d

Browse files
committed
add comment about convergence check
1 parent 557095a commit e1ef07d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

bayesflow/utils/optimal_transport/log_sinkhorn.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def contains_nans(plan):
3131

3232
def is_converged(plan):
3333
# for convergence, the plan should be doubly stochastic
34+
# NOTE: for small atol and rtol, using rtol_log=0.0 and atol_log=atol + rtol
35+
# is equivalent to the convergence check in the unstabilized version
3436
conv0 = keras.ops.all(keras.ops.isclose(keras.ops.logsumexp(plan, axis=0), 0.0, rtol=0.0, atol=atol + rtol))
3537
conv1 = keras.ops.all(keras.ops.isclose(keras.ops.logsumexp(plan, axis=1), 0.0, rtol=0.0, atol=atol + rtol))
3638
return conv0 & conv1

0 commit comments

Comments
 (0)