'weight') get_pruned_conv(
Granularity
What block of parameter to remove in a neural network ?
Conv2d Pruning
A Conv2d
layer possess a 4d-tensor as weights. This means that there exist many ways of removing blocks from it.
0-D Blocks
In the case of convolution filters, removing 0-D elements is equivalent to removing individual weights.
weight
granularity
1-D Blocks
1-D blocks of elements is equivalent to removing vectors from the convolution filters. There are several ways to chose the vectors, that will be represented below.
shared_weight
: this granularity is very particular as it removes individual weights from a filter, but with a pattern that is shared across all filters.
'shared_weight') get_pruned_conv(
channel
: remove vector of weights along the channel axis.
'channel') get_pruned_conv(
column
: remove vector of weights along the height axis.
'column') get_pruned_conv(
row
: remove vector of weights along the width axis.
'row') get_pruned_conv(
2-D Blocks
shared_channel
: remove vector of weight along the channel axis, but with a pattern that is shared across all filters.
'shared_channel') get_pruned_conv(
shared_column
: remove vector of weight along the height axis, but with a pattern that is shared across all filters.
'shared_column') get_pruned_conv(
shared_row
: remove vector of weight along the width axis, but with a pattern that is shared across all filters.
'shared_row') get_pruned_conv(
vertical_slice
: remove vertical slices of weight along the height axis.
'vertical_slice') get_pruned_conv(
horizontal_slice
: remove vertical slices of weight along the width axis.
'horizontal_slice') get_pruned_conv(
kernel
: remove kernels of from the convolution filters.
'kernel') get_pruned_conv(
3-D Blocks
shared_vertical_slice
: remove vertical slices of weight along the height axis, with a pattern that is shared across all filters.
'shared_vertical_slice') get_pruned_conv(
shared_horizontal_slice
: remove horizontal slices of weight along the width axis, with a pattern that is shared across all filters.
'shared_horizontal_slice') get_pruned_conv(
shared_kernel
: remove kernels of weight from the convolution filters, with a pattern that is shared across all filters.
'shared_kernel') get_pruned_conv(
filter
: remove entire filters.
'filter') get_pruned_conv(
Linear Pruning
0-D Blocks
As for the convolution filters, weights from a Linear layer can be removed independently.
weight
: remove individual weights.
'weight') get_pruned_linear(
1-D Blocks
column
: remove column of weight, which corresponds to removing input neurons.
'column') get_pruned_linear(
row
: remove rows of weight, which corresponds to removing output neurons.
'row') get_pruned_linear(
Transformer Pruning
Note
This is an experimental part of the library