xref: /aosp_15_r20/external/pytorch/test/test_ao_sparsity.py (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1*da0073e9SAndroid Build Coastguard Worker# Owner(s): ["module: unknown"]
2*da0073e9SAndroid Build Coastguard Worker
3*da0073e9SAndroid Build Coastguard Worker# Kernels
4*da0073e9SAndroid Build Coastguard Workerfrom ao.sparsity.test_kernels import (  # noqa: F401
5*da0073e9SAndroid Build Coastguard Worker    TestQuantizedSparseKernels,
6*da0073e9SAndroid Build Coastguard Worker    TestQuantizedSparseLayers,
7*da0073e9SAndroid Build Coastguard Worker)
8*da0073e9SAndroid Build Coastguard Worker
9*da0073e9SAndroid Build Coastguard Worker# Parametrizations
10*da0073e9SAndroid Build Coastguard Workerfrom ao.sparsity.test_parametrization import TestFakeSparsity  # noqa: F401
11*da0073e9SAndroid Build Coastguard Worker
12*da0073e9SAndroid Build Coastguard Worker# Scheduler
13*da0073e9SAndroid Build Coastguard Workerfrom ao.sparsity.test_scheduler import TestCubicScheduler, TestScheduler  # noqa: F401
14*da0073e9SAndroid Build Coastguard Worker
15*da0073e9SAndroid Build Coastguard Worker# Sparsifier
16*da0073e9SAndroid Build Coastguard Workerfrom ao.sparsity.test_sparsifier import (  # noqa: F401
17*da0073e9SAndroid Build Coastguard Worker    TestBaseSparsifier,
18*da0073e9SAndroid Build Coastguard Worker    TestNearlyDiagonalSparsifier,
19*da0073e9SAndroid Build Coastguard Worker    TestWeightNormSparsifier,
20*da0073e9SAndroid Build Coastguard Worker)
21*da0073e9SAndroid Build Coastguard Worker
22*da0073e9SAndroid Build Coastguard Worker# Structured Pruning
23*da0073e9SAndroid Build Coastguard Workerfrom ao.sparsity.test_structured_sparsifier import (  # noqa: F401
24*da0073e9SAndroid Build Coastguard Worker    TestBaseStructuredSparsifier,
25*da0073e9SAndroid Build Coastguard Worker    TestFPGMPruner,
26*da0073e9SAndroid Build Coastguard Worker    TestSaliencyPruner,
27*da0073e9SAndroid Build Coastguard Worker)
28*da0073e9SAndroid Build Coastguard Worker
29*da0073e9SAndroid Build Coastguard Workerfrom torch.testing._internal.common_utils import IS_ARM64, run_tests
30*da0073e9SAndroid Build Coastguard Worker
31*da0073e9SAndroid Build Coastguard Worker
32*da0073e9SAndroid Build Coastguard Worker# Composability
33*da0073e9SAndroid Build Coastguard Workerif not IS_ARM64:
34*da0073e9SAndroid Build Coastguard Worker    from ao.sparsity.test_composability import (  # noqa: F401
35*da0073e9SAndroid Build Coastguard Worker        TestComposability,
36*da0073e9SAndroid Build Coastguard Worker        TestFxComposability,
37*da0073e9SAndroid Build Coastguard Worker    )
38*da0073e9SAndroid Build Coastguard Worker
39*da0073e9SAndroid Build Coastguard Worker# Activation Sparsifier
40*da0073e9SAndroid Build Coastguard Workerfrom ao.sparsity.test_activation_sparsifier import (  # noqa: F401
41*da0073e9SAndroid Build Coastguard Worker    TestActivationSparsifier,
42*da0073e9SAndroid Build Coastguard Worker)
43*da0073e9SAndroid Build Coastguard Worker
44*da0073e9SAndroid Build Coastguard Worker# Data Scheduler
45*da0073e9SAndroid Build Coastguard Workerfrom ao.sparsity.test_data_scheduler import TestBaseDataScheduler  # noqa: F401
46*da0073e9SAndroid Build Coastguard Worker
47*da0073e9SAndroid Build Coastguard Worker# Data Sparsifier
48*da0073e9SAndroid Build Coastguard Workerfrom ao.sparsity.test_data_sparsifier import (  # noqa: F401
49*da0073e9SAndroid Build Coastguard Worker    TestBaseDataSparsifier,
50*da0073e9SAndroid Build Coastguard Worker    TestNormDataSparsifiers,
51*da0073e9SAndroid Build Coastguard Worker    TestQuantizationUtils,
52*da0073e9SAndroid Build Coastguard Worker)
53*da0073e9SAndroid Build Coastguard Worker
54*da0073e9SAndroid Build Coastguard Worker# Utilities
55*da0073e9SAndroid Build Coastguard Workerfrom ao.sparsity.test_sparsity_utils import TestSparsityUtilFunctions  # noqa: F401
56*da0073e9SAndroid Build Coastguard Worker
57*da0073e9SAndroid Build Coastguard Worker
58*da0073e9SAndroid Build Coastguard Workerif __name__ == "__main__":
59*da0073e9SAndroid Build Coastguard Worker    run_tests()
60