neural_compressor.pruner.pruner_legacy.gradient_sensitivity
¶
Gradient sensitivity pruner.
Module Contents¶
Classes¶
Gradient sensitivity pruner class. |
- class neural_compressor.pruner.pruner_legacy.gradient_sensitivity.GradientSensitivityPruner(model, local_config, global_config)¶
Bases:
neural_compressor.pruner.pruner_legacy.pruner.Pruner
Gradient sensitivity pruner class.
- Parameters:
- on_epoch_begin(epoch)¶
Be called on the beginning of epochs.
- on_step_begin(batch_id)¶
Multiple mask to weight elementwisely when elementwise_prune is True.
- on_epoch_end()¶
Be called on the end of epochs.
- parse_weight_name(weight_name_pattern)¶
Parse weight name.
- on_step_end()¶
Update importance tensor.
- compute_mask()¶
Compute masks according to absolute values.
- prune_weight(model, importance, weight_name, parameters)¶
Prune the specified weight by importance.
- update_importance_elementwise(model, importance, weight_name)¶
Update importance tensor elementwisely.
- update_importance_abs(model, importance, weight_name, parameters)¶
Update importance tensor with absolute gradient.
- update_importance_weighted(model, importance, weight_name, parameters)¶
Update importance tensor with weighted gradient.
- prune_by_importance(tensor, importance, num_instances, stride)¶
Reserve specified number of weights only by importance.