neural_compressor.pruner.pruner_legacy.pattern_lock

Pattern lock pruner.

Module Contents

Classes

PatternLockPruner

Pattern lock pruner class.

class neural_compressor.pruner.pruner_legacy.pattern_lock.PatternLockPruner(model, local_config, global_config)

Bases: neural_compressor.pruner.pruner_legacy.pruner.Pruner

Pattern lock pruner class.

Parameters:
  • model (object) – The original model (currently PyTorchModel instance).

  • local_config (Conf) – configs specific for this pruning instance.

  • global_config (Conf) – global configs which may be overwritten by local_config.

on_epoch_begin(epoch)

Be called on the beginning of epochs.

on_step_begin(batch_id)

Be called on the beginning of steps.

on_epoch_end()

Be called on the end of epochs.

on_step_end()

Update weights.

compute_mask()

Compute masks according to current sparsity pattern.

update_weights()

Update weights according to the masks.