move const defs of DeviceType to DeviceType.h (#19185)
authorJerry Zhang <jerryzh168@gmail.com>
Wed, 17 Apr 2019 02:55:48 +0000 (19:55 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 17 Apr 2019 03:02:21 +0000 (20:02 -0700)
Summary:
Stack:
&nbsp;&nbsp;&nbsp;&nbsp;:black_circle:&nbsp; **#19185 [c10][core][ez] move const defs of DeviceType to DeviceType.h**&nbsp;&nbsp;[:yellow_heart:](https://our.intern.facebook.com/intern/diff/D14909415/)

att
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19185

Differential Revision: D14909415

Pulled By: jerryzh168

fbshipit-source-id: 876cf999424d8394f5ff20e6750133a4e43466d4

c10/core/Backend.h
c10/core/DeviceType.h

index 2fa5c47..1f8e585 100644 (file)
@@ -223,12 +223,6 @@ static inline Backend backendToHIP(Backend b) {
   }
 }
 
-constexpr DeviceType kCPU = DeviceType::CPU;
-constexpr DeviceType kCUDA = DeviceType::CUDA;
-constexpr DeviceType kHIP = DeviceType::HIP;
-constexpr DeviceType kMSNPU = DeviceType::MSNPU;
-constexpr DeviceType kXLA = DeviceType::XLA;
-
 static inline const char* toString(Backend b) {
   switch (b) {
     case Backend::CPU:
index f23d170..9f75966 100644 (file)
@@ -31,6 +31,12 @@ enum class DeviceType : int16_t {
   ONLY_FOR_TEST = 20901, // This device type is only for test.
 };
 
+constexpr DeviceType kCPU = DeviceType::CPU;
+constexpr DeviceType kCUDA = DeviceType::CUDA;
+constexpr DeviceType kHIP = DeviceType::HIP;
+constexpr DeviceType kMSNPU = DeviceType::MSNPU;
+constexpr DeviceType kXLA = DeviceType::XLA;
+
 // define explicit int constant
 constexpr int COMPILE_TIME_MAX_DEVICE_TYPES =
     static_cast<int>(DeviceType::COMPILE_TIME_MAX_DEVICE_TYPES);
@@ -53,7 +59,7 @@ C10_API bool isValidDeviceType(DeviceType d);
 
 C10_API std::ostream& operator<<(std::ostream& stream, DeviceType type);
 
-} // namespace at
+} // namespace c10
 
 namespace std {
 template <> struct hash<c10::DeviceType> {