Use c10::variant-based enums for Nonlinearity and FanMode
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27933
Test Plan: Imported from OSS
Differential Revision: D18009044
Pulled By: yf225
fbshipit-source-id: e88229ee30badf7a699f62af61d1e88debc0dc7d