[ao][sparsity] Refactor and bugfix SparseQuantizedLayer tests (#81802)
Summary: Needed to refactor this PR to add tests for some new layers without copy pasting the entirety of the code. Its basically just a helper that does exactly what the other tests did since they were essentially copies of one another. Its possible to do similar with the quantized kernels test but its different enough that it seemed more effort than it was worth. Also bugfix: Originally line 150 I believe was wrong since model.weight is never used, though the only effect was that the specific weight wasn't used.
Test Plan: python test/test_ao_sparsity.py TestQuantizedSparseLayers
Reviewers:
Subscribers:
Tasks:
Tags:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81802
Approved by: https://github.com/supriyar