ruihangdu / PyTorch-Deep-Compression

A PyTorch implementation of the iterative pruning method described in Han et. al. (2015)
40 stars 10 forks source link

Question about computation reduction #3

Open Planck35 opened 5 years ago

Planck35 commented 5 years ago

You did a very nice implement But I want to ask for the weight that got masked by zero in weights.

Did the whole computation increase but weight's value are zero? or the computation speed is just normal?

ruihangdu commented 5 years ago

@planck35 By computation do you mean the amount of computation (i.e. number of floating-point operations)? If so, then no, the amount of computation would be roughly the same after pruning but should not increase.

chen-ming2019 commented 5 years ago

@larry0123du Hi,I used the code in my model,but the pruning model size is perfectly equal to the model size before pruning. What is the reason for the phenomenon?

ruihangdu commented 5 years ago

The reason is that the weights are simply truncated to zero but zero is still represented as a floating point number. So in essence, as long as the size of matrices is unchanged, your model would not change in size. In the original paper Han et al supplemented with a Huffman encoding scheme which would boost the performance if I remembered right.

chen-ming2019 commented 5 years ago

@larry0123du ok ,thanks!

theoldgun commented 5 years ago

@larry0123du hello,the weights are simply truncated to zero,will the inference speed increase?