weiaicunzai/pytorch-cifar100

Tensor sizes mismatches

tehreemnaqvi opened this issue · 4 comments

Hi,

I am implementing ResNet18 models using the CIFAR-100 dataset.

I checked all the dimensions but got this error:

RuntimeError: The size of tensor a (100) must match the size of tensor b (32) at non-singleton dimension 3

Can you please tell me how to fix it?

Thanks

RuntimeError: The size of tensor a (100) must match the size of tensor b (32) at non-singleton dimension 3

Could you plz tell me you are implementing ResNet18 yourself or using my code?Last time I checked, my implementation works fine.

own dataset, img size 128x128, resnet18 is ok, but vgg16, I got:
RuntimeError: size mismatch, m1: [128 x 8192], m2: [512 x 4096]

[128 x 8192], m2: [512 x 4096]

VGG does not have adaptive pooling layer, so you have to modify the fully connected layer in VGG16 to adapt your dataset since cifar100 only have 32x32 image size.

You have to check the dimension output in the vgg.py line 38. After checking the output dimension, you should modify the self.classifier function that matches your size.