Thank you. What I am unable to understand is from my calculation, I get 6400 (64 * 10 * 10), for the input features for the linear call, but the number of input features that works fine is 2304, instead of 6400. In that case the Flatten and the nn.linear work perfectly fine.
nn.Linear(in_features=2304, out_features=512), => Can you please help me understand how the input features are 2304, (instead of 6400)?
Following is the steps of Conv2d and max2d done (twice) before passing to the linear.
    nn.Conv2d(in_channels=3, out_channels=32, kernel_size=3, padding=1),#28*28*32
    nn.BatchNorm2d(32),
    nn.ReLU(),
    nn.MaxPool2d(kernel_size=2, stride=2), #14*14*32

    nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3), #12*12*64
    nn.BatchNorm2d(64),
    nn.ReLU(),
    nn.MaxPool2d(2), #10*10*64 I get 6400, but the linear works for 2304.
    nn.Linear(in_features=2304, out_features=512)