Thanks for your reply! Yes I have grayscale images. That makes sense, but why is it saying the required size should be [16, 1, 5, 5]? If the requirement is [batch_size, channels, height, width], shouldn’t the required size be [5, 1, 28, 28] instead of [16, 1, 5, 5]?
I made the change you suggested but I am getting a different error now: “RuntimeError: Input type (torch.cuda.LongTensor) and weight type (torch.cuda.FloatTensor) should be the same”
Does input here refer to the image? When I try to cast to float:
outputs = model(images.float())

I get the same error as before:
RuntimeError: Expected 4-dimensional input for 4-dimensional weight [16, 1, 5, 5], but got 3-dimensional input of size [5, 28, 28] instead


Is there another way I should fix the new error about FloatTensor vs. LongTensor?