Skip to content

Commit b05d315

Browse files
committed
Moved GPU doctests to test_gpu for tests not to fail if no GPU available
1 parent 93a74fe commit b05d315

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

ot/gpu/bregman.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,6 @@ def sinkhorn_knopp(a, b, M, reg, numItermax=1000, stopThr=1e-9,
7070
log : dict
7171
log dictionary return only if log==True in parameters
7272
73-
Examples
74-
--------
75-
76-
>>> import ot
77-
>>> a=[.5,.5]
78-
>>> b=[.5,.5]
79-
>>> M=[[0.,1.],[1.,0.]]
80-
>>> ot.sinkhorn(a,b,M,1)
81-
array([[ 0.36552929, 0.13447071],
82-
[ 0.13447071, 0.36552929]])
83-
8473
8574
References
8675
----------

test/test_gpu.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515
nogpu = True
1616

1717

18+
@pytest.mark.skipif(nogpu, reason="No GPU available")
19+
def test_gpu_old_doctests():
20+
a = [.5, .5]
21+
b = [.5, .5]
22+
M = [[0., 1.], [1., 0.]]
23+
G = ot.sinkhorn(a, b, M, 1)
24+
np.testing.assert_allclose(G, np.array([[0.36552929, 0.13447071],
25+
[0.13447071, 0.36552929]]))
26+
27+
1828
@pytest.mark.skipif(nogpu, reason="No GPU available")
1929
def test_gpu_dist():
2030

0 commit comments

Comments
 (0)