I have pruned the conv layers of a CNN. Now I need to make the last conv layer compatible with the fist linear layer. How to do it?
Assuming you have reduced the number of output channels of the conv layer you would also need to reduce the in_features
by the same factor. Note that activations are usually flattened before being passed to the first linear layer from [batch_size, channels, height, width]
to [batch_size, channels*height*width]
, so the channels are a multiplicative factor.