Optimize arguments checks (#46661)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/46661
Test Plan: Imported from OSS
Reviewed By: zou3519
Differential Revision: D24453342
Pulled By: izdeby
fbshipit-source-id: 26866fdbc9dc2b5410b3b728b175a171cc6a4521