diff options
author | Gard Spreemann <gspr@nonempty.org> | 2023-06-14 16:51:31 +0200 |
---|---|---|
committer | Gard Spreemann <gspr@nonempty.org> | 2023-06-14 16:51:31 +0200 |
commit | 96788a3fe5601e4c3f49b592aa0d9c034247862e (patch) | |
tree | 5ee3ebcdea05f6766fc9858344913e40487e9067 /test/test_backend.py | |
parent | 35bd2c98b642df78638d7d733bc1a89d873db1de (diff) | |
parent | 89f1613861152432807077fbb146578611dc5888 (diff) |
Merge tag '0.9.0' into dfsg/latestdfsg/latest
Diffstat (limited to 'test/test_backend.py')
-rw-r--r-- | test/test_backend.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/test_backend.py b/test/test_backend.py index 311c075..fd9a761 100644 --- a/test/test_backend.py +++ b/test/test_backend.py @@ -275,11 +275,27 @@ def test_empty_backend(): with pytest.raises(NotImplementedError): nx.sqrtm(M) with pytest.raises(NotImplementedError): + nx.kl_div(M, M) + with pytest.raises(NotImplementedError): nx.isfinite(M) with pytest.raises(NotImplementedError): nx.array_equal(M, M) with pytest.raises(NotImplementedError): nx.is_floating_point(M) + with pytest.raises(NotImplementedError): + nx.tile(M, (10, 1)) + with pytest.raises(NotImplementedError): + nx.floor(M) + with pytest.raises(NotImplementedError): + nx.prod(M) + with pytest.raises(NotImplementedError): + nx.sort2(M) + with pytest.raises(NotImplementedError): + nx.qr(M) + with pytest.raises(NotImplementedError): + nx.atan2(v, v) + with pytest.raises(NotImplementedError): + nx.transpose(M) def test_func_backends(nx): @@ -592,11 +608,47 @@ def test_func_backends(nx): lst_b.append(nx.to_numpy(A)) lst_name.append("matrix square root") + A = nx.kl_div(nx.abs(Mb), nx.abs(Mb) + 1) + lst_b.append(nx.to_numpy(A)) + lst_name.append("Kullback-Leibler divergence") + A = nx.concatenate([vb, nx.from_numpy(np.array([np.inf, np.nan]))], axis=0) A = nx.isfinite(A) lst_b.append(nx.to_numpy(A)) lst_name.append("isfinite") + A = nx.tile(vb, (10, 1)) + lst_b.append(nx.to_numpy(A)) + lst_name.append("tile") + + A = nx.floor(Mb) + lst_b.append(nx.to_numpy(A)) + lst_name.append("floor") + + A = nx.prod(Mb) + lst_b.append(nx.to_numpy(A)) + lst_name.append("prod") + + A, B = nx.sort2(Mb) + lst_b.append(nx.to_numpy(A)) + lst_name.append("sort2 sort") + lst_b.append(nx.to_numpy(B)) + lst_name.append("sort2 argsort") + + A, B = nx.qr(Mb) + lst_b.append(nx.to_numpy(A)) + lst_name.append("QR Q") + lst_b.append(nx.to_numpy(B)) + lst_name.append("QR R") + + A = nx.atan2(vb, vb) + lst_b.append(nx.to_numpy(A)) + lst_name.append("atan2") + + A = nx.transpose(Mb) + lst_b.append(nx.to_numpy(A)) + lst_name.append("transpose") + 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( |