Move most BUILD_NAMEDTENSOR macros out of header areas (#25721)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25721
Context: I am starting to work on removing the BUILD_NAMEDTENSOR flag.
Here is the approach:
- Move the macro out of header areas
- Include a new `enable_namedtensor.h` header that does a `#ifndef
BUILD_NAMEDTENSOR #define BUILD_NAMEDTENSOR`.
- Include `enable_namedtensor.h` where necessary. This only really needs
to happen in two files (c10/TensorImpl.h, ATen/Dimname.h).
- Incrementally delete usages of the BUILD_NAMEDTENSOR macro later.
The alternative is to straight up delete all instances of
BUILD_NAMEDTENSOR. This alternative could be disruptive, lead to merge
conflicts, and isn't incremental.
Along with the above, some work needs to be done on feature flagging
named tensors, and merging the namedtensor CI with the regular CI, and
communicating with devs. This work will too be done incrementally.
Test Plan
- [namedtensor ci]
Test Plan: Imported from OSS
Differential Revision: D17210913
Pulled By: zou3519
fbshipit-source-id: c73f128b976bb90212639e8f2a3ad2a6a52b8e0c