RuntimeError: size mismatch, m1: [512 x 3072], m2: [784 x 48] - Error in fitting the model with CIFAR10 dataset

I am doing the excersice problem in BatchNorm_Dropot Notebook to try the dropout with CIFAR10 dataset and encountered the following error:

Runtime Error: size mismatch, m1: [512 x 3072], m2: [784 x 48] at /pytorch/aten/src/TH/generic/THTensorMath.cpp:41

Hi, can you please take a snapshot after expanding those 6 hidden frames?

Sure @Ishvinder,

Here it is,

Can you recheck for the input and weight shape?
Make sure that both matrices have appropriate shape to be multiplied.

Hey @Ishvinder,

The inputs to the model and the model with batch norm. for the MNIST dataset is :

[96, 1, 28, 28]

However, the same for the CIFAR10 dataset is:

[512, 3, 32, 32]

Please help me to morph the given code to adapt for the CIFAR10 dataset.

Here the first dimension refers to the batch size, which you can change. Whereas if you’re trying to use CIFAR10 dataset, you should pad the image with 2.

1 Like

Thanks @Ishvinder, for the help!