Once you change the input size of image, the size of feature map which is the output of the last conv layer changes. So the view operation fails.
The error RuntimeError: size ‘[-1 x 400]’ is invalid for input of with 5408 elements at /b/wheel/pytorch-src/torch/lib/TH/THStorage.c:55 raises because 5408 (the actual feature map size) can’t be divided by 400 (fully connected layer size you defined).