From a70020465b8c1cef61b51d51ccaf272a6d0b4149 Mon Sep 17 00:00:00 2001 From: "Rong Rong (AI Infra)" Date: Sat, 22 May 2021 13:14:50 -0700 Subject: [PATCH] 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 --- test/run_test.py | 1 + test/test_sparse_csr.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/test/run_test.py b/test/run_test.py index 0374b9f2561..0314f7e6346 100755 --- a/test/run_test.py +++ b/test/run_test.py @@ -81,6 +81,7 @@ TESTS = [ 'test_xnnpack_integration', 'test_vulkan', 'test_sparse', + 'test_sparse_csr', 'test_quantization', 'test_pruning_op', 'test_spectral_ops', diff --git a/test/test_sparse_csr.py b/test/test_sparse_csr.py index 949b5fc44d6..23d3d1d7a0b 100644 --- a/test/test_sparse_csr.py +++ b/test/test_sparse_csr.py @@ -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]: