mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE] Nested namespace in ATen/native
headers (#103753)
Use nested namespace and `enum class` in `ATen/native` headers. In particular, it helps avoid polluting global namespace with `MAX`,`MIN` enum values. Pull Request resolved: https://github.com/pytorch/pytorch/pull/103753 Approved by: https://github.com/atalman, https://github.com/Skylion007
This commit is contained in:
committed by
PyTorch MergeBot
parent
fd4beb7a05
commit
f1b367c418
@ -15,24 +15,24 @@ using namespace vec;
|
||||
#define AT_DISPATCH_REDUCTION_TYPES(op, ...) \
|
||||
[&] { \
|
||||
switch (op) { \
|
||||
case SUM: { \
|
||||
static constexpr ReductionType reduce = SUM; \
|
||||
case ReductionType::SUM: { \
|
||||
static constexpr auto reduce = ReductionType::SUM; \
|
||||
return __VA_ARGS__(); \
|
||||
} \
|
||||
case MEAN: { \
|
||||
static constexpr ReductionType reduce = MEAN; \
|
||||
case ReductionType::MEAN: { \
|
||||
static constexpr auto reduce = ReductionType::MEAN; \
|
||||
return __VA_ARGS__(); \
|
||||
} \
|
||||
case MIN: { \
|
||||
static constexpr ReductionType reduce = MIN; \
|
||||
case ReductionType::MIN: { \
|
||||
static constexpr auto reduce = ReductionType::MIN; \
|
||||
return __VA_ARGS__(); \
|
||||
} \
|
||||
case MAX: { \
|
||||
static constexpr ReductionType reduce = MAX; \
|
||||
case ReductionType::MAX: { \
|
||||
static constexpr auto reduce = ReductionType::MAX; \
|
||||
return __VA_ARGS__(); \
|
||||
} \
|
||||
case PROD: { \
|
||||
static constexpr ReductionType reduce = PROD; \
|
||||
case ReductionType::PROD: { \
|
||||
static constexpr auto reduce = ReductionType::PROD; \
|
||||
return __VA_ARGS__(); \
|
||||
} \
|
||||
} \
|
||||
|
Reference in New Issue
Block a user