Use template OperatorGenerator for prim and special operator registration (#43481)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/43481
Apply OperatorGenerator for prim and special operator registration. It does not affect the existing build by default. However, if a whitelist of operator exists, only the operators in the whitelist will be registered. It has the potential to save up to 200 KB binary size, depending on the usage.
Test Plan: Imported from OSS
Reviewed By: ljk53
Differential Revision: D23287251
Pulled By: iseeyuan
fbshipit-source-id: 3ca39fbba645bad8d69e69195f3680e4f6d633c5