Rate this Page

torchao.sparsity#

Created On: Dec 17, 2025 | Last Updated On: Dec 17, 2025

sparsify_

Convert the weight of linear modules in the model with apply_tensor_subclass.

semi_sparse_weight

alias of SemiSparseWeightConfig

apply_fake_sparsity

This function simulates 2:4 sparsity on all linear layers in a model.

WandaSparsifier

Wanda sparsifier

PerChannelNormObserver

A custom observer that computes the L2 norm of each channel and stores it in a buffer.