I have data with 4 classes and size of each image is 64.
But I try to use conv layer instead of fully connected layer.
I used adaptive pooling layer and it is solve the problem of train network with image of any size
How we make  ConvTranspose2d  does the job of
        nn.AdaptiveAvgPool2d((1,1)))

then
self.fc2 = nn.Linear(32, num_classes)