Creation of Model

Hello, am trying to recreate the model from (https://arxiv.org/pdf/1207.0580.pdf appendix G - Models for Cifar10). So I should construct a CNN with 3 convolutional layers each followed by a subsam-
pling/pooling layer. The convolutional layers should consist of 64 5x5 filters and the subsampling layers implement the max-pooling function over a window of size 3x3 using a stride of 2. In the end, I must connect the 3rd pooling layer to a 10-way softmax output layer. But when am trying to create this model, am having technical difficulties.

So output shape for each layer would look like this:

    Layer (type)               Output Shape         

================================================================
Input [3,32,32]
Conv2d-1 [64, 28, 28]
MaxPool2d-2 [64, 13, 13]
Conv2d-3 [64, 9, 9]
MaxPool2d-4 [64, 4, 4]
///////////////////////////////////////////////////////// I can’t add another Conv2vd with kernal_size = 5 x 5,
///////////////////////////////////////////////////////// because it would lead to
Conv2d-5 [64, 4 - 5 , 4 - 5 ] - > error.

================================================================

So this model can’t be created? Or am doing something wrong?

You can’t add the last conv layer because the kernel size is larger than the input in spatial dim (4x4 input and 5x5 kernel). This happen because you are using the conv layer without padding thus the output is smaller than input.

Try adjusting padding that preserve the input spatial dim

1 Like