mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-08 07:39:33 +01:00
18 lines
629 B
C++
18 lines
629 B
C++
// TODO: I'm pretty sure Constness can be done with C++ templates, ala
|
|
// std::is_const, but no time to work it out...
|
|
#define GENERIC_IF(Constness, FullKind, x, Kind) \
|
|
auto && __match_key = x; \
|
|
switch(__match_key->kind()) { \
|
|
case FullKind: { \
|
|
auto * value = static_cast<Constness ::torch::jit::Kind*>(__match_key); (void) value;
|
|
#define GENERIC_ELSEIF(Constness, FullKind, Kind) \
|
|
} break; \
|
|
case FullKind: { \
|
|
auto * value = static_cast<Constness ::torch::jit::Kind*>(__match_key); (void) value;
|
|
#define GENERIC_ELSE() \
|
|
} break; \
|
|
default: {
|
|
#define GENERIC_END() \
|
|
} break; \
|
|
};
|