pytorch/caffe2/onnx/device.h
Shai Szulanski 0ddaaf6a92 [codemod][caffe2] Run clang-format - 5/7
Summary:
This directory is opted-in to clang-format but is not format-clean. This blocks continuous formatting from being enabled on fbcode, and causes hassle for other codemods that leave inconsistent formatting. This diff runs clang-format, which is widely used and considered safe.

If you are unhappy with the formatting of a particular block, please *accept this diff* and then in a stacked commit undo the change and wrap that code in `// clang-format off` and `// clang-format on`, or `/* clang-format off */` and `/* clang-format on */`.

drop-conflicts

Test Plan: sandcastleit

Reviewed By: jerryzh168

Differential Revision: D22311706

fbshipit-source-id: 1ca59a82e96156a4a5dfad70ba3e64d44c5e762a
2020-06-30 15:45:11 -07:00

28 lines
488 B
C++

#pragma once
#include <functional>
#include <string>
namespace caffe2 {
namespace onnx {
enum class DeviceType { CPU = 0, CUDA = 1 };
struct Device {
Device(const std::string& spec);
DeviceType type;
int device_id{-1};
};
} // namespace onnx
} // namespace caffe2
namespace std {
template <>
struct hash<caffe2::onnx::DeviceType> {
std::size_t operator()(const caffe2::onnx::DeviceType& k) const {
return std::hash<int>()(static_cast<int>(k));
}
};
} // namespace std