adding test_sparse_csr to run_test (#58666)

Summary:
fixes https://github.com/pytorch/pytorch/issues/58632.

Added several skips that relates to test assert and MKL. Will address them in separate PR.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/58666

Reviewed By: seemethere, janeyx99

Differential Revision: D28607966

Pulled By: walterddr

fbshipit-source-id: 066d4afce2672e4026334528233e69f68da04965
This commit is contained in:
Rong Rong (AI Infra)
2021-05-22 13:14:50 -07:00
committed by Facebook GitHub Bot
parent 22776f0857
commit a70020465b
2 changed files with 11 additions and 1 deletions

View File

@ -81,6 +81,7 @@ TESTS = [
'test_xnnpack_integration',
'test_vulkan',
'test_sparse',
'test_sparse_csr',
'test_quantization',
'test_pruning_op',
'test_spectral_ops',

View File

@ -1,6 +1,8 @@
import torch
import warnings
from torch.testing._internal.common_utils import TestCase, run_tests, load_tests, coalescedonoff
import unittest
from torch.testing._internal.common_utils import \
(IS_MACOS, IS_WINDOWS, TestCase, run_tests, load_tests, coalescedonoff)
from torch.testing._internal.common_device_type import \
(instantiate_device_type_tests, dtypes, onlyCPU)
@ -81,7 +83,10 @@ class TestSparseCSR(TestCase):
size, dtype=dtype, device=device)
@onlyCPU
@unittest.skip("see: https://github.com/pytorch/pytorch/issues/58762")
def test_sparse_csr_print(self, device):
orig_maxDiff = self.maxDiff
self.maxDiff = None
shape_nnz = [
((10, 10), 10),
((100, 10), 10),
@ -112,6 +117,7 @@ class TestSparseCSR(TestCase):
printed.append('')
printed.append('')
self.assertExpected('\n'.join(printed))
self.maxDiff = orig_maxDiff
@onlyCPU
def test_sparse_csr_from_dense(self, device):
@ -157,6 +163,7 @@ class TestSparseCSR(TestCase):
@coalescedonoff
@onlyCPU
@dtypes(torch.double)
@unittest.skipIf(IS_MACOS or IS_WINDOWS, "see: https://github.com/pytorch/pytorch/issues/58757")
def test_coo_to_csr_convert(self, device, dtype, coalesced):
size = (5, 5)
sparse_dim = 2
@ -186,6 +193,7 @@ class TestSparseCSR(TestCase):
@onlyCPU
@dtypes(torch.float, torch.double)
@unittest.skipIf(IS_MACOS or IS_WINDOWS, "see: https://github.com/pytorch/pytorch/issues/58757")
def test_mkl_matvec_warnings(self, device, dtype):
if torch.has_mkl:
for index_dtype in [torch.int32, torch.int64]:
@ -211,6 +219,7 @@ class TestSparseCSR(TestCase):
@onlyCPU
@dtypes(torch.float, torch.double)
@unittest.skipIf(IS_MACOS or IS_WINDOWS, "see: https://github.com/pytorch/pytorch/issues/58757")
def test_csr_matvec(self, device, dtype):
side = 100
for index_dtype in [torch.int32, torch.int64]: