Add std::variant backport (mpark) as c10::variant, with gcc 7.3.1 fix (#27575)
Summary:
This is the same as https://github.com/pytorch/pytorch/pull/26836 with workarounds for gcc 7.3.1 bug in light of https://github.com/pytorch/pytorch/pull/27277#issue-324044466. The workaround also limits the use cases of `c10::variant`, but it is sufficient for our (simple) use case.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27575
Differential Revision: D17834410
Pulled By: yf225
fbshipit-source-id: e8f3c0be2904ec3d2975cbb80af237a5c9d0cb92