updated error message and added test (#169685)
Summary:
Fixes #161831
X-link: https://github.com/pytorch/pytorch/pull/169685
Approved by: https://github.com/Lucaskabela, https://github.com/mlazos, https://github.com/pianpwk
Reviewed By: izaitsevfb
Differential Revision: D88867214
fbshipit-source-id: e4bdc81f8b7e7fd4ff159385dbaa6e0fad493497
Author
generatedunixname499836121