Skip to content

Commit 35aa1e5

Browse files
committed
Remove whitespace
1 parent 22324fc commit 35aa1e5

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

ot/bregman.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# Mokhtar Z. Alaya <mokhtarzahdi.alaya@gmail.com>
1212
# Alexander Tong <alexander.tong@yale.edu>
1313
# Ievgen Redko <ievgen.redko@univ-st-etienne.fr>
14+
# Quang Huy Tran <quang-huy.tran@univ-ubs.fr>
1415
#
1516
# License: MIT License
1617

@@ -1728,7 +1729,7 @@ def empirical_sinkhorn(X_s, X_t, reg, a=None, b=None, metric='sqeuclidean',
17281729
If True, then only calculate the cost matrix by block and return the dual potentials only (to save memory)
17291730
If False, calculate full cost matrix and return outputs of sinkhorn function.
17301731
batchSize: int or tuple of 2 int, optional
1731-
Size of the batcheses used to compute the sinkhorn update without memory overhead.
1732+
Size of the batcheses used to compute the sinkhorn update without memory overhead.
17321733
When a tuple is provided it sets the size of the left/right batches.
17331734
verbose : bool, optional
17341735
Print information along iterations
@@ -1879,7 +1880,7 @@ def empirical_sinkhorn2(X_s, X_t, reg, a=None, b=None, metric='sqeuclidean', num
18791880
If True, then only calculate the cost matrix by block and return the dual potentials only (to save memory)
18801881
If False, calculate full cost matrix and return outputs of sinkhorn function.
18811882
batchSize: int or tuple of 2 int, optional
1882-
Size of the batcheses used to compute the sinkhorn update without memory overhead.
1883+
Size of the batcheses used to compute the sinkhorn update without memory overhead.
18831884
When a tuple is provided it sets the size of the left/right batches.
18841885
verbose : bool, optional
18851886
Print information along iterations

test/test_bregman.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Author: Remi Flamary <remi.flamary@unice.fr>
44
# Kilian Fatras <kilian.fatras@irisa.fr>
5+
# Quang Huy Tran <quang-huy.tran@univ-ubs.fr>
56
#
67
# License: MIT License
78

@@ -341,19 +342,19 @@ def test_lazy_empirical_sinkhorn():
341342
M = ot.dist(X_s, X_t)
342343
M_m = ot.dist(X_s, X_t, metric='minkowski')
343344

344-
f, g = ot.bregman.empirical_sinkhorn(X_s, X_t, 1, numIterMax=numIterMax, isLazy=True, batchSize=(1, 1))
345+
f, g = ot.bregman.empirical_sinkhorn(X_s, X_t, 1, numIterMax=numIterMax, isLazy=True, batchSize=(1, 1), verbose=True)
345346
G_sqe = np.exp(f[:, None] + g[None, :] - M / 1)
346347
sinkhorn_sqe = ot.sinkhorn(a, b, M, 1)
347348

348-
f, g, log_es = ot.bregman.empirical_sinkhorn(X_s, X_t, 0.1, log=True, numIterMax=numIterMax, isLazy=True, batchSize=1)
349+
f, g, log_es = ot.bregman.empirical_sinkhorn(X_s, X_t, 0.1, numIterMax=numIterMax, isLazy=True, batchSize=1, log=True)
349350
G_log = np.exp(f[:, None] + g[None, :] - M / 0.1)
350351
sinkhorn_log, log_s = ot.sinkhorn(a, b, M, 0.1, log=True)
351352

352353
f, g = ot.bregman.empirical_sinkhorn(X_s, X_t, 1, metric='minkowski', numIterMax=numIterMax, isLazy=True, batchSize=1)
353354
G_m = np.exp(f[:, None] + g[None, :] - M_m / 1)
354355
sinkhorn_m = ot.sinkhorn(a, b, M_m, 1)
355356

356-
loss_emp_sinkhorn = ot.bregman.empirical_sinkhorn2(X_s, X_t, 1, numIterMax=numIterMax, isLazy=True, batchSize=1)
357+
loss_emp_sinkhorn, log = ot.bregman.empirical_sinkhorn2(X_s, X_t, 1, numIterMax=numIterMax, isLazy=True, batchSize=1, log=True)
357358
loss_sinkhorn = ot.sinkhorn2(a, b, M, 1)
358359

359360
# check constratints

0 commit comments

Comments
 (0)