@@ -97,7 +97,6 @@ def test_sag_asgd_sinkhorn():
97
97
98
98
x = rng .randn (n , 2 )
99
99
u = ot .utils .unif (n )
100
- zero = np .zeros (n )
101
100
M = ot .dist (x , x )
102
101
103
102
G_asgd = ot .stochastic .solve_semi_dual_entropic (u , u , M , reg , "asgd" ,
@@ -108,13 +107,13 @@ def test_sag_asgd_sinkhorn():
108
107
109
108
# check constratints
110
109
np .testing .assert_allclose (
111
- zero , ( G_sag - G_sinkhorn ) .sum (1 ), atol = 1e-03 ) # cf convergence sag
110
+ G_sag . sum ( 1 ), G_sinkhorn .sum (1 ), atol = 1e-03 )
112
111
np .testing .assert_allclose (
113
- zero , ( G_sag - G_sinkhorn ) .sum (0 ), atol = 1e-03 ) # cf convergence sag
112
+ G_sag . sum ( 0 ), G_sinkhorn .sum (0 ), atol = 1e-03 )
114
113
np .testing .assert_allclose (
115
- zero , ( G_asgd - G_sinkhorn ) .sum (1 ), atol = 1e-03 ) # cf convergence asgd
114
+ G_asgd . sum ( 1 ), G_sinkhorn .sum (1 ), atol = 1e-03 )
116
115
np .testing .assert_allclose (
117
- zero , ( G_asgd - G_sinkhorn ) .sum (0 ), atol = 1e-03 ) # cf convergence asgd
116
+ G_asgd . sum ( 0 ), G_sinkhorn .sum (0 ), atol = 1e-03 )
118
117
np .testing .assert_allclose (
119
118
G_sag , G_sinkhorn , atol = 1e-03 ) # cf convergence sag
120
119
np .testing .assert_allclose (
@@ -175,7 +174,6 @@ def test_dual_sgd_sinkhorn():
175
174
# Test uniform
176
175
x = rng .randn (n , 2 )
177
176
u = ot .utils .unif (n )
178
- zero = np .zeros (n )
179
177
M = ot .dist (x , x )
180
178
181
179
G_sgd = ot .stochastic .solve_dual_entropic (u , u , M , reg , batch_size ,
@@ -185,17 +183,16 @@ def test_dual_sgd_sinkhorn():
185
183
186
184
# check constratints
187
185
np .testing .assert_allclose (
188
- zero , abs ( G_sgd - G_sinkhorn ) .sum (1 ), atol = 1e-03 ) # cf convergence sgd
186
+ G_sgd . sum ( 1 ), G_sinkhorn .sum (1 ), atol = 1e-03 )
189
187
np .testing .assert_allclose (
190
- zero , abs ( G_sgd - G_sinkhorn ) .sum (0 ), atol = 1e-03 ) # cf convergence sgd
188
+ G_sgd . sum ( 0 ), G_sinkhorn .sum (0 ), atol = 1e-03 )
191
189
np .testing .assert_allclose (
192
190
G_sgd , G_sinkhorn , atol = 1e-03 ) # cf convergence sgd
193
191
194
192
# Test gaussian
195
193
n = 30
196
194
reg = 1
197
195
batch_size = 30
198
- zero = np .zeros (n )
199
196
200
197
a = ot .datasets .make_1D_gauss (n , 15 , 5 ) # m= mean, s= std
201
198
b = ot .datasets .make_1D_gauss (n , 15 , 5 )
@@ -211,8 +208,8 @@ def test_dual_sgd_sinkhorn():
211
208
212
209
# check constratints
213
210
np .testing .assert_allclose (
214
- zero , abs ( G_sgd - G_sinkhorn ) .sum (1 ), atol = 1e-03 ) # cf convergence sgd
211
+ G_sgd . sum ( 1 ), G_sinkhorn .sum (1 ), atol = 1e-03 )
215
212
np .testing .assert_allclose (
216
- zero , abs ( G_sgd - G_sinkhorn ) .sum (0 ), atol = 1e-03 ) # cf convergence sgd
213
+ G_sgd . sum ( 0 ), G_sinkhorn .sum (0 ), atol = 1e-03 )
217
214
np .testing .assert_allclose (
218
215
G_sgd , G_sinkhorn , atol = 1e-03 ) # cf convergence sgd
0 commit comments