Which PyTorch version are you using?
A wrong input shape should yield an easy to understand shape mismatch error. The shape check was recently broken, but was fixed in 1.9.1. If you are seeing this error in this version, it would be great to see your code, as this error message is more then unhelpful.