latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
tensorplay.ao.pruning.identity
- tensorplay.ao.pruning.identity(module: Module, name: str) Module[source]
Attach the pruning reparameterization to
module[name]without pruning any unit.Modifies the module in place (and also returns it) by:
adding a named buffer called
name + '_mask'holding the binary mask applied to the parametername;replacing the parameter
nameby its masked version, while the original (unmasked) values are stored in a new parameter namedname + '_orig'.
Note
The mask is a tensor of ones.
- Parameters:
module – module containing the tensor to prune.
name – parameter name within
moduleon which pruning acts.
- Returns:
The modified (i.e. pruned) module.
Examples
>>> # xdoctest: +SKIP >>> m = identity(nn.Linear(2, 3), "bias") >>> print(m.bias_mask) tensor([1., 1., 1.])
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

