"git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "f69eee6108cd047ac8b62a2992244e9ab3c105e1"
Commit 35b09b7b authored by rusty1s's avatar rusty1s
Browse files

fix device eye test

parent d474adfa
...@@ -9,7 +9,7 @@ from .utils import dtypes, devices ...@@ -9,7 +9,7 @@ from .utils import dtypes, devices
@pytest.mark.parametrize('dtype,device', product(dtypes, devices)) @pytest.mark.parametrize('dtype,device', product(dtypes, devices))
def test_eye(dtype, device): def test_eye(dtype, device):
mat = SparseTensor.eye(3, dtype=dtype, device=device) mat = SparseTensor.eye(3, dtype=dtype, device=device)
assert mat.storage.col().device == device assert mat.device() == device
assert mat.storage.sparse_sizes() == (3, 3) assert mat.storage.sparse_sizes() == (3, 3)
assert mat.storage.row().tolist() == [0, 1, 2] assert mat.storage.row().tolist() == [0, 1, 2]
assert mat.storage.rowptr().tolist() == [0, 1, 2, 3] assert mat.storage.rowptr().tolist() == [0, 1, 2, 3]
...@@ -18,8 +18,8 @@ def test_eye(dtype, device): ...@@ -18,8 +18,8 @@ def test_eye(dtype, device):
assert mat.storage.value().dtype == dtype assert mat.storage.value().dtype == dtype
assert mat.storage.num_cached_keys() == 0 assert mat.storage.num_cached_keys() == 0
mat = SparseTensor.eye(3, has_value=False) mat = SparseTensor.eye(3, has_value=False, device=device)
assert mat.storage.col().device == device assert mat.device() == device
assert mat.storage.sparse_sizes() == (3, 3) assert mat.storage.sparse_sizes() == (3, 3)
assert mat.storage.row().tolist() == [0, 1, 2] assert mat.storage.row().tolist() == [0, 1, 2]
assert mat.storage.rowptr().tolist() == [0, 1, 2, 3] assert mat.storage.rowptr().tolist() == [0, 1, 2, 3]
...@@ -27,8 +27,8 @@ def test_eye(dtype, device): ...@@ -27,8 +27,8 @@ def test_eye(dtype, device):
assert mat.storage.value() is None assert mat.storage.value() is None
assert mat.storage.num_cached_keys() == 0 assert mat.storage.num_cached_keys() == 0
mat = SparseTensor.eye(3, 4, fill_cache=True) mat = SparseTensor.eye(3, 4, fill_cache=True, device=device)
assert mat.storage.col().device == device assert mat.device() == device
assert mat.storage.sparse_sizes() == (3, 4) assert mat.storage.sparse_sizes() == (3, 4)
assert mat.storage.row().tolist() == [0, 1, 2] assert mat.storage.row().tolist() == [0, 1, 2]
assert mat.storage.rowptr().tolist() == [0, 1, 2, 3] assert mat.storage.rowptr().tolist() == [0, 1, 2, 3]
...@@ -40,8 +40,8 @@ def test_eye(dtype, device): ...@@ -40,8 +40,8 @@ def test_eye(dtype, device):
assert mat.storage.csr2csc().tolist() == [0, 1, 2] assert mat.storage.csr2csc().tolist() == [0, 1, 2]
assert mat.storage.csc2csr().tolist() == [0, 1, 2] assert mat.storage.csc2csr().tolist() == [0, 1, 2]
mat = SparseTensor.eye(4, 3, fill_cache=True) mat = SparseTensor.eye(4, 3, fill_cache=True, device=device)
assert mat.storage.col().device == device assert mat.device() == device
assert mat.storage.sparse_sizes() == (4, 3) assert mat.storage.sparse_sizes() == (4, 3)
assert mat.storage.row().tolist() == [0, 1, 2] assert mat.storage.row().tolist() == [0, 1, 2]
assert mat.storage.rowptr().tolist() == [0, 1, 2, 3, 3] assert mat.storage.rowptr().tolist() == [0, 1, 2, 3, 3]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment