Main Content

Pruning

Reduce the number of learnable parameters in a neural network by pruning the least important filters in convolutional layers

Pruning reduces the number of learnable parameters in a neural network by removing the least important filters in convolutional layers.

If you can train your network using the trainnet function, then prune your network by using the compressNetworkUsingTaylorPruning function. If you cannot train your network using the trainnet function, then create a custom pruning loop by using a taylorPrunableNetwork object instead.

For a detailed overview of the compression techniques available in Deep Learning Toolbox™ Model Compression Library, see Reduce Memory Footprint of Deep Neural Networks.

Simplified illustration of pruning. On the left is a sketch of a neural network with three layers that consist of four, three, and four neurons, respectively. All neurons are connected to all other neurons. An arrow points to a second sketch on the right that shows the same network, but one neuron has been cut out from the middle layer, and two neurons have been cut out from the final layer.

Functions

expand all

compressNetworkUsingTaylorPruningCompress neural network using Taylor pruning (Since R2026a)
taylorPrunableNetworkNeural network suitable for compression using Taylor pruning (Since R2022a)
forwardCompute deep learning network output for training
predictCompute deep learning network output for inference
updatePrunablesRemove filters from prunable layers based on importance scores (Since R2022a)
updateScoreCompute and accumulate Taylor-based importance scores for pruning (Since R2022a)

Topics

Featured Examples