With .squeeze(0):
  File "/usr/local/lib/python2.7/dist-packages/torch/legacy/nn/Module.py", line 33, in forward
    return self.updateOutput(input)
  File "/usr/local/lib/python2.7/dist-packages/torch/legacy/nn/Sequential.py", line 36, in updateOutput
    currentOutput = module.updateOutput(currentOutput)
  File "/usr/local/lib/python2.7/dist-packages/torch/legacy/nn/SpatialConvolution.py", line 96, in updateOutput
    self.padW, self.padH
RuntimeError: Need input of dimension 4 and input.size[1] == 64 but got input to be of shape: [1 x 3 x 512 x 682] at /home/ubuntu/pytorch/aten/src/THNN/generic/SpatialConvolutionMM.c:65

Without .squeeze(0):
  File "/usr/local/lib/python2.7/dist-packages/torch/legacy/nn/Module.py", line 33, in forward
    return self.updateOutput(input)
  File "/usr/local/lib/python2.7/dist-packages/torch/legacy/nn/Sequential.py", line 36, in updateOutput
    currentOutput = module.updateOutput(currentOutput)
  File "/usr/local/lib/python2.7/dist-packages/torch/legacy/nn/SpatialConvolution.py", line 96, in updateOutput
    self.padW, self.padH
RuntimeError: Need input of dimension 3 and input.size[0] == 64 but got input to be of shape: [3 x 512 x 682] at /home/ubuntu/pytorch/aten/src/THNN/generic/SpatialConvolutionMM.c:65

I load the image via:
    image = Image.open(image_name)
    loader = transforms.Compose([transforms.Resize(image_size), transforms.ToTensor()])  # resize and convert to tensor
    image = image.unsqueeze(0)

How do I make sure the image is the required input size for updateOutput?
Edit:
I forgot an axis for .Resize, but the error still remains:
transforms.Compose([transforms.Resize((image_size, image_size)), transforms.ToTensor()])