How can I use pytorch to implement layer pruning of my own defined resnet series models?

57 views Asked by At

Hello everyone!This is my initial question. Thank you very much for your help.

I now want to directly delete a certain convolutional layer in my model, such as a convolutional layer in resnet18 with an input of 64 channels and an output of 128 channels. My current problem is that if I directly remove this convolutional layer and directly connect the i-1 layer (the output is 64 channels) and the i+1 layer (the input is 128 channels), the outputs will not match the inputs. What should I do?

Another solution is that if I replace the original convolution kernel with 1*1 convolution kernels in the i-th layer, and only realize the function of matching the output of the i-1 layer and the input of the i+1 layer, then these convolution kernels What parameters should I set to? My scenario is to replace this layer and use it directly without any fine-tuning process or changing the parameters of other layers.

0

There are 0 answers