Magnitude Pruning
CLI Equivalent: apr prune --method magnitude --sparsity 0.5 model.apr
What This Demonstrates
Unstructured magnitude pruning that zeros out weights below a threshold. The simplest pruning method -- removes weights with the smallest absolute values to achieve target sparsity.
Run
cargo run --example prune_magnitude
Key APIs
prune_magnitude(tensor, sparsity)-- zero out smallest weights to reach target sparsitysparsity_ratio(tensor)-- measure fraction of zero weightsModelBundleV2::new().with_quantization(Quantization::FP32)-- save pruned model