diff options
author | Clément Bonet <32179275+clbonet@users.noreply.github.com> | 2023-04-18 18:01:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-18 18:01:19 +0200 |
commit | 9aa96c8247afd6e98d8bd470a6adb1be0f1c467e (patch) | |
tree | 3f213c8d844d6f24f88c83deebec55f45391e4f9 /test/test_backend.py | |
parent | 1078dcc3530a7f95fd77d19d115d46f39c2574bc (diff) |
[MRG] Fix Bug binary_search_circle on GPU and Gradients (#457)
* W circle + SSW
* Tests + Example SSW_1
* Example Wasserstein Circle + Tests
* Wasserstein on the circle wrt Unif
* Example SSW unif
* pep8
* np.linalg.qr for numpy < 1.22 by batch + add python3.11 to tests
* np qr
* rm test python 3.11
* update names, tests, backend transpose
* Comment error batchs
* semidiscrete_wasserstein2_unif_circle example
* torch permute method instead of torch.permute for previous versions
* update comments and doc
* doc wasserstein circle model as [0,1[
* Added ot.utils.get_coordinate_circle to get coordinates on the circle in turn
* Bug cuda w_circle + gradient ssw
* Bug cuda w_circle + gradient ssw
* backend detach
* Add PR in Releases.md
---------
Co-authored-by: Rémi Flamary <remi.flamary@gmail.com>
Diffstat (limited to 'test/test_backend.py')
-rw-r--r-- | test/test_backend.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_backend.py b/test/test_backend.py index fd9a761..5351e52 100644 --- a/test/test_backend.py +++ b/test/test_backend.py @@ -296,6 +296,8 @@ def test_empty_backend(): nx.atan2(v, v) with pytest.raises(NotImplementedError): nx.transpose(M) + with pytest.raises(NotImplementedError): + nx.detach(M) def test_func_backends(nx): @@ -649,6 +651,16 @@ def test_func_backends(nx): lst_b.append(nx.to_numpy(A)) lst_name.append("transpose") + A = nx.detach(Mb) + lst_b.append(nx.to_numpy(A)) + lst_name.append("detach") + + A, B = nx.detach(Mb, Mb) + lst_b.append(nx.to_numpy(A)) + lst_name.append("detach A") + lst_b.append(nx.to_numpy(B)) + lst_name.append("detach B") + assert not nx.array_equal(Mb, vb), "array_equal (shape)" assert nx.array_equal(Mb, Mb), "array_equal (elements) - expected true" assert not nx.array_equal( |