Skip to content

Reenable test_sparse unit tests that are now passing in ROCm #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions test/test_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ def test_contig_hybrid(self):
self.assertEqual(exp_i, x._indices())
self.assertEqual(exp_v, x._values())

@skipIfRocm
def test_clone(self):
x, _, _ = self._gen_sparse(4, 20, 5)
if self.is_uncoalesced:
Expand Down Expand Up @@ -618,7 +617,6 @@ def test_spadd_hybrid(self):
self._test_spadd_shape([50, 30, 20], [2])
self._test_spadd_shape([5, 5, 5, 5, 5, 5], [2])

@skipIfRocm
def test_norm(self):
x, _, _ = self._gen_sparse(3, 10, 100)
y = x.coalesce()
Expand Down Expand Up @@ -701,7 +699,6 @@ def test_basic_ops_hybrid(self):
self._test_basic_ops_shape([50, 30, 20], [2])
self._test_basic_ops_shape([5, 5, 5, 5, 5, 5], [2])

@skipIfRocm
def test_add_dense_sparse_mismatch(self):
x = torch.zeros([3, 4], dtype=self.value_dtype, device=self.device)
sparse_y = self.SparseTensor(torch.zeros(1, 4, dtype=torch.int64, device=self.device),
Expand Down Expand Up @@ -949,7 +946,6 @@ def test_sparse_mask_hybrid(self):
self._test_sparse_mask_shape([50, 30, 20], [2])
self._test_sparse_mask_shape([5, 5, 5, 5, 5, 5], [2])

@skipIfRocm
def test_sparse_add_coalesce(self):
i = self.IndexTensor([[1, 2, 1]])
v = self.ValueTensor([3, 4, 5])
Expand All @@ -966,7 +962,6 @@ def test_storage_not_null(self):

@cuda_only
@unittest.skipIf(torch.cuda.device_count() < 2, "only one GPU detected")
@skipIfRocm
def test_same_gpu(self):
i = self.IndexTensor([[2]]).cuda(1)
v = self.ValueTensor([5]).cuda(1)
Expand Down Expand Up @@ -1044,7 +1039,6 @@ def test_factory(self):
self.assertEqual(device, sparse_tensor._values().device)
self.assertEqual(True, sparse_tensor.requires_grad)

@skipIfRocm
def test_factory_size_check(self):
indices = self.IndexTensor([[1, 2], [0, 2]])
values = self.ValueTensor([.5, .5])
Expand Down Expand Up @@ -1087,7 +1081,6 @@ def test_factory_empty_indices(self):
expected_indices = torch.empty((4, 0), dtype=torch.long, device=device)
self.assertEqual(tensor._indices(), expected_indices)

@skipIfRocm
def test_factory_nnz(self):
indices = self.IndexTensor([[0]]) # (sparseDims, nnz): (1, 1)
values = self.ValueTensor([[1, 1], [1, 1]]) # (nnz, ...): (2, 2)
Expand Down Expand Up @@ -1115,7 +1108,6 @@ def test_factory_nnz_zero(self):
self._test_factory_tensor_shape([3, 0], [0, 2, 4, 0], [0, 0, 0, 2, 4, 0], [0, 0, 0, 2, 4, 0])
self._test_factory_tensor_shape([3, 0], [0, 2, 4, 0], [1, 2, 3, 2, 4, 0], [1, 2, 3, 2, 4, 0])

@skipIfRocm
def test_factory_dense_dims(self):
indices = self.IndexTensor([[0]])
values = self.ValueTensor([[[1, 1, 1], [1, 1, 1]]])
Expand All @@ -1133,7 +1125,6 @@ def test_factory_type_inference(self):
self.assertEqual(torch.int64, t.dtype)

@cuda_only
@skipIfRocm
def test_factory_device_type_inference(self):
# both indices/values are CUDA
shape = (1, 3)
Expand Down Expand Up @@ -1191,7 +1182,6 @@ def test_empty_full(self):
TestTorch._test_empty_full(self, all_sparse_dtypes, torch.sparse_coo, None)
TestTorch._test_empty_full(self, all_sparse_dtypes, torch.sparse_coo, torch.device('cuda:0'))

@skipIfRocm
def test_is_sparse(self):
x = torch.randn(3, 3)
self.assertFalse(x.is_sparse)
Expand Down Expand Up @@ -1233,7 +1223,6 @@ def _test_resize_shape(self, x_i, x_v, x_size, y_i, y_v, y_size):
self.assertEqual(x.to_dense().view(-1)[0:x_v_numel].view(x_v),
x_dense.view(-1)[0:x_v_numel].view(x_v))

@skipIfRocm
def test_resize(self):
# 1. Increase the size of some dense dimensions [Supported]
self._test_resize_shape([1, 1], [1, 2, 3], [2, 2, 3],
Expand Down Expand Up @@ -1307,7 +1296,6 @@ def setUp(self):

class TestSparseOneOff(TestCase):
@unittest.skipIf(not TEST_CUDA, 'CUDA not available')
@skipIfRocm
def test_cuda_from_cpu(self):
self.assertExpectedRaises(
RuntimeError,
Expand All @@ -1316,7 +1304,6 @@ def test_cuda_from_cpu(self):
[3, 4, 4]))

@unittest.skipIf(not TEST_CUDA, 'CUDA not available')
@skipIfRocm
def test_cuda_sparse_cpu_dense_add(self):
x = torch.zeros(3, 4, 4)
sparse_y = torch.cuda.sparse.FloatTensor(torch.zeros(1, 4).long().cuda(),
Expand Down