rethinking-network-pruning icon indicating copy to clipboard operation
rethinking-network-pruning copied to clipboard

size mismatch, m1: [2 x 288], m2: [8 x 120]

Open tejalal opened this issue 5 years ago • 1 comments

I am trying to prune simple LeNet5 model using L1-norm pruning and CIFAR10 dataset. The model has 6 kernels in the first layer and 16 in the second convolutional layer. The output of the last convolutional layer of the original model is 16x6x6 and the number of nodes in the first dense layer is 120 which makes a matrics of [576, 120]. The output dimension of the last convolutional layer after pruning (5 kernels are pruned from first layer and 8 from second layer) is 6x6x8 that makes a matrics of [288, 120]. But while training it is giving dimension mismatch error. The problem is in copying weights from original model to pruned model in the dense layer. Here is the code where weights are being copied.

Untitled

size mismatch, m1: [2 x 288], m2: [8 x 120] at /pytorch/aten/src/THC/generic/THCTensorMathBlas.cu:290 Any Suggestions ???

tejalal avatar Feb 24 '20 16:02 tejalal

The pruning code may not work for architectures not stated in the README. So you may need to update the code for pruning lenet?

Eric-mingjie avatar Feb 25 '20 03:02 Eric-mingjie