|
Algorithm 2: Pruning Neurons. |
| 1: Input: The model weights W, the prune rate α, the number of prune iterations iter
|
| 2: Get which is the number of elements in W
|
| 3: Get the number of W that need pruning
|
| 4: Calculate the importance of neurons, get the neuron importance score matrix
|
| 5: Sorting from large to small |
| 6: Get the prune threshold of neuron importance score
|
| 7: While
i < m
do
|
| 8: if
< thr
then
|
| 9: W = 0 |
| 10: end
|
| 11:
|
| 12: end
|
| 13: While
k < iter
do
|
| 14: Retrain the model to update parameters according to Algorithm 1 |
| 15: Execute step 2–12 |
| 16:
|
| 17: end
|