This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add network trimming pruning algorithm and fix bias mask(testing) (#1867
- Loading branch information
1 parent
80a49a1
commit b0c0eb7
Showing
12 changed files
with
793 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
ActivationRankFilterPruner on NNI Compressor | ||
=== | ||
|
||
## 1. Introduction | ||
|
||
ActivationRankFilterPruner is a series of pruners which prune filters according to some importance criterion calculated from the filters' output activations. | ||
|
||
| Pruner | Importance criterion | Reference paper | | ||
| :----------------------------: | :-------------------------------: | :----------------------------------------------------------: | | ||
| ActivationAPoZRankFilterPruner | APoZ(average percentage of zeros) | [Network Trimming: A Data-Driven Neuron Pruning Approach towards Efficient Deep Architectures](https://arxiv.org/abs/1607.03250) | | ||
| ActivationMeanRankFilterPruner | mean value of output activations | [Pruning Convolutional Neural Networks for Resource Efficient Inference](https://arxiv.org/abs/1611.06440) | | ||
|
||
## 2. Pruners | ||
|
||
### ActivationAPoZRankFilterPruner | ||
|
||
Hengyuan Hu, Rui Peng, Yu-Wing Tai and Chi-Keung Tang, | ||
|
||
"[Network Trimming: A Data-Driven Neuron Pruning Approach towards Efficient Deep Architectures](https://arxiv.org/abs/1607.03250)", ICLR 2016. | ||
|
||
ActivationAPoZRankFilterPruner prunes the filters with the smallest APoZ(average percentage of zeros) of output activations. | ||
|
||
The APoZ is defined as: | ||
|
||
 | ||
|
||
### ActivationMeanRankFilterPruner | ||
|
||
Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila and Jan Kautz, | ||
|
||
"[Pruning Convolutional Neural Networks for Resource Efficient Inference](https://arxiv.org/abs/1611.06440)", ICLR 2017. | ||
|
||
ActivationMeanRankFilterPruner prunes the filters with the smallest mean value of output activations | ||
|
||
## 3. Usage | ||
|
||
PyTorch code | ||
|
||
```python | ||
from nni.compression.torch import ActivationAPoZRankFilterPruner | ||
config_list = [{ 'sparsity': 0.8, 'op_types': ['Conv2d'], 'op_names': ['conv1', 'conv2'] }] | ||
pruner = ActivationAPoZRankFilterPruner(model, config_list, statistics_batch_num=1) | ||
pruner.compress() | ||
``` | ||
|
||
#### User configuration for ActivationAPoZRankFilterPruner | ||
|
||
- **sparsity:** This is to specify the sparsity operations to be compressed to | ||
- **op_types:** Only Conv2d is supported in ActivationAPoZRankFilterPruner | ||
|
||
## 4. Experiment | ||
|
||
TODO. | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.