TensorPlay
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-08

tensorplay.ao.pruning.is_pruned

tensorplay.ao.pruning.is_pruned(module: Module) → bool[source]

Check whether module carries an active pruning reparameterization.

Scans every submodule for forward pre-hooks that are instances of BasePruningMethod.

Parameters:

module – module that is either pruned or unpruned.

Returns:

True when at least one submodule is pruned, False otherwise.

Examples

>>> # xdoctest: +SKIP
>>> m = nn.Linear(5, 7)
>>> print(is_pruned(m))
False
>>> random_unstructured(m, name="weight", amount=0.2)
>>> print(is_pruned(m))
True

On this page

Ask DeepWiki