Followup to #17049: change more instances of RuntimeError to IndexError
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17114
Differential Revision: D14150890
Pulled By: gchanan
fbshipit-source-id: 579ca71665166c6a904b894598a0b334f0d8acc7