Could you replace this line:
x = x.view(-1, 256*7*7)

with
x = x.view(x.size(0), -1)
print(x.shape)

I guess you might not be using the same preprocessing pipeline and thus your images might have a different spatial shape during evaluation.
Let me know, if that’s the case or if you still see an error.