coreai_opt.pruning.PruningSpec

class coreai_opt.pruning.PruningSpec[source]

Bases: CompressionSpec

Specification for pruning tensors.

target_sparsity

Fraction of elements to prune, in [0, 1]. Default: 0.5.

Type:

float

pruning_scheme

Structural pattern of sparsity. Default: Unstructured().

Type:

PruningScheme

pruning_algo

Pruning implementation class. Default: "default" (magnitude-based pruning).

Type:

type[PruneImplBase]

Example

>>> spec = PruningSpec()
>>> spec.target_sparsity
0.5
>>> spec = PruningSpec(target_sparsity=0.75)