Skip to content

Commit 46aeb9b

Browse files
committed
fix version guards
1 parent 5acff84 commit 46aeb9b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/sparsity/test_sparse_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
)
1414

1515
from torchao.sparsity import apply_fake_sparsity, semi_sparse_weight, sparsify_
16-
from torchao.utils import TORCH_VERSION_AFTER_2_5, TORCH_VERSION_AT_LEAST_2_3
16+
from torchao.utils import TORCH_VERSION_AFTER_2_5, TORCH_VERSION_AT_LEAST_2_3, TORCH_VERSION_AT_LEAST_2_5, TORCH_VERSION_AT_LEAST_2_4
1717

1818

1919
logging.basicConfig(
@@ -48,7 +48,7 @@ def test_sparse(self):
4848

4949
class TestQuantSemiSparse(common_utils.TestCase):
5050

51-
@unittest.skipIf(not TORCH_VERSION_AT_LEAST_2_3, "pytorch 2.3+ feature")
51+
@unittest.skipIf(not TORCH_VERSION_AT_LEAST_2_4, "pytorch 2.4+ feature")
5252
@unittest.skipIf(not torch.cuda.is_available(), "Need CUDA available")
5353
@common_utils.parametrize("compile", [True, False])
5454
def test_quant_semi_sparse(self, compile):
@@ -79,6 +79,7 @@ def test_quant_semi_sparse(self, compile):
7979

8080
torch.testing.assert_close(dense_result, sparse_result, rtol=1e-2, atol=1e-2)
8181

82+
@unittest.skipIf(not TORCH_VERSION_AT_LEAST_2_5, "pytorch 2.5+ feature")
8283
@unittest.skipIf(not torch.cuda.is_available(), "Need CUDA available")
8384
@common_utils.parametrize("compile", [True, False])
8485
def test_sparse_marlin(self, compile):
@@ -110,7 +111,7 @@ def test_sparse_marlin(self, compile):
110111

111112

112113
class TestBlockSparseWeight(common_utils.TestCase):
113-
@unittest.skipIf(not TORCH_VERSION_AT_LEAST_2_3, "pytorch 2.3+ feature")
114+
@unittest.skipIf(not TORCH_VERSION_AT_LEAST_2_4, "pytorch 2.4+ feature due to need for custom op support")
114115
@unittest.skipIf(not torch.cuda.is_available(), "Need CUDA available")
115116
@common_utils.parametrize("compile", [True, False])
116117
def test_sparse(self, compile):

0 commit comments

Comments
 (0)