nncf.torch.sparsity.const.algo#

Classes#

ConstSparsityController

Controller for the auxiliary constant sparsity algorithm in PT.

class nncf.torch.sparsity.const.algo.ConstSparsityController(target_model, sparsified_module_info)[source]#

Bases: nncf.torch.sparsity.base_algo.BaseSparsityAlgoController

Controller for the auxiliary constant sparsity algorithm in PT.

Parameters:
  • target_model (nncf.torch.nncf_network.NNCFNetwork) –

  • sparsified_module_info (List[SparseModuleInfo]) –

freeze()[source]#

Freezes all sparsity masks. Sparsity masks will not be trained after calling this method.

set_sparsity_level(sparsity_level)[source]#

Sets the sparsity level that should be applied to the model’s weights.

Parameters:

sparsity_level (float) – Sparsity level that should be applied to the model’s weights.

statistics(quickly_collected_only=False)[source]#

Returns a Statistics class instance that contains compression algorithm statistics.

Parameters:

quickly_collected_only (bool) – Enables collection of the statistics that don’t take too much time to compute. Can be helpful for the case when need to keep track of statistics on each training batch/step/iteration.

Return type:

nncf.common.statistics.NNCFStatistics