I think you meant to do data = data.unsqueeze(0). Also, it might be softmax is not included in the pretrained model (as softmax is usually combined with the loss function, so we have to manually add softmax at test time).