Use templates instead of macros when defining bitwise operators. (#33835)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/33835
Test Plan: Imported from OSS
Differential Revision: D20131414
Pulled By: VitalyFedyunin
fbshipit-source-id: ec7eb7cb14e037a277cc8d71d5c9df27abf51752