neural_compressor.experimental.pytorch_pruner.patterns
Pattern module.
Module Contents
Classes
Pruning Pattern. |
|
Pruning Pattern. |
|
Pruning Pattern. |
Functions
|
Class decorator used to register a Pattern subclass to the registry. |
|
Get registered pattern class. |
- neural_compressor.experimental.pytorch_pruner.patterns.register_pattern(name)[source]
Class decorator used to register a Pattern subclass to the registry.
Decorator function used before a Pattern subclasses. Make sure that this Pattern class can be registered in PATTERNS.
- Parameters:
cls (class) – The class of register.
name – A string. Define the pattern type which will be included in a pruning process.
- Returns:
The class of register.
- Return type:
cls
- neural_compressor.experimental.pytorch_pruner.patterns.get_pattern(config)[source]
Get registered pattern class.
Get a Pattern object from PATTERNS.
- Parameters:
config – A config dict object. Contains the pattern information.
- Returns:
A Pattern object.
- Raises:
AssertionError – Currently only support patterns which have been registered in PATTERNS.
- class neural_compressor.experimental.pytorch_pruner.patterns.Pattern(config)[source]
Pruning Pattern.
Every Pruner object will contain a Pattern object. It defines the basic pruning unit and how this unit will be pruned during pruning.
- Parameters:
config – A config dict object. Contains the pattern information.
- class neural_compressor.experimental.pytorch_pruner.patterns.PatternNxM(config)[source]
Pruning Pattern.
A Pattern class derived from Pattern. In this pattern, the weights in a NxM block will be pruned or kept during one pruning step.
- Parameters:
config – A config dict object. Contains the pattern information.
- class neural_compressor.experimental.pytorch_pruner.patterns.PatternNInM(config)[source]
Pruning Pattern.
A Pattern class derived from Pattern. In this pattern, N out of every M continuous weights will be pruned. For more info of this pattern, please refer to https://github.com/intel/neural-compressor/blob/master/docs/pruning.md
- Parameters:
config – A config dict object. Contains the pattern information.