Fix attribute warning on gcc (#38988)
Summary:
When building, my log was being spammed with:
```
warning: attribute "__visibility__" does not apply here
```
Which, at least on gcc 7.4 isn't covered by silencing `-Wattribute`. The warning suggests `enum`s don't need to be exported on linux, so I just `ifdef` it out instead.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/38988
Differential Revision: D21722032
Pulled By: ezyang
fbshipit-source-id: ed4cfebc187dceaa9e748d85f756611fd7eda4b4