Moving the constant parameter check to a more common file (#64251)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64251
Test Plan: Imported from OSS
Reviewed By: zou3519
Differential Revision: D31161850
Pulled By: Gamrix
fbshipit-source-id: 5db3e6d52c99c1f40455c601122bb7680a287ae5