Pruning Configuration

class model_compression_toolkit.pruning.PruningConfig(num_score_approximations=PRUNING_NUM_SCORE_APPROXIMATIONS, importance_metric=ImportanceMetric.LFH, channels_filtering_strategy=ChannelsFilteringStrategy.GREEDY)

Configuration class for specifying how a neural network should be pruned.

num_score_approximations

The number of score approximations to perform when calculating channel importance.

Type:

int

importance_metric

The metric used to calculate channel importance.

Type:

ImportanceMetric

channels_filtering_strategy

The strategy used to filter out channels.

Type:

ChannelsFilteringStrategy

Initializes a PruningConfig object with default or specified parameters.

Parameters:
  • num_score_approximations (int) – The number of times to approximate the scoring for channel importance. Defaults to a predefined constant value.

  • importance_metric (ImportanceMetric) – The method used for calculating the importance of channels in a network. Defaults to label-free Hessian (LFH) approximation.

  • channels_filtering_strategy (ChannelsFilteringStrategy) – The strategy for selecting which channels to prune. Defaults to a greedy approach.

ImportanceMetric

class model_compression_toolkit.pruning.ImportanceMetric(value)

Enum for specifying the metric used to determine the importance of channels when pruning:

LFH - Label-Free Hessian uses hessian info for measuring each channel’s sensitivity.

ChannelsFilteringStrategy

class model_compression_toolkit.pruning.ChannelsFilteringStrategy(value)

Enum for specifying the strategy used for filtering (pruning) channels:

GREEDY - Prune the least important channel groups up to the allowed resources utilization limit (for now, only weights_memory is considered).