Shortcuts

torchao.sparsity

sparsify_

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

semi_sparse_weight

Convert the weight of linear moduels to semi-structured (2:4) sparsity

int8_dynamic_activation_int8_semi_sparse_weight

Applies int8 dnynamic symmetric per-token activation and int8 per-channel weight quantization + 2:4 sparsity to linear layers.

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.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources