This line of code is raising the issue:
images = images.reshape(-1, input_size).to(device)

since the input_size is incompatible to the shape of images.
If you want to flatten the tensor, use x = x.view(x.size(0), -1) instead which will also keep the batch size equal.
In your code I can only find input_size = 616, which also doesn’t match the posted error message, so I guess you might have changed the code already.