Thank you. It is working now. But it is showing another error:
RuntimeError: Given input size: (512x1x1). Calculated output size: (512x-5x-5). Output size is too small
This means CIFAR10 cannot be used for resnet18? how can I use CIFAR10, with a pretrained Resnet?