1 #include "caffe2/onnx/device.h" 4 #include <unordered_map> 7 static const std::unordered_map<std::string, DeviceType> kDeviceMap = {
8 {
"CPU", DeviceType::CPU},
9 {
"CUDA", DeviceType::CUDA}
12 Device::Device(
const std::string &spec) {
13 auto pos = spec.find_first_of(
':');
14 type = kDeviceMap.at(spec.substr(0, pos - 1));
15 device_id = atoi(spec.substr(pos + 1).c_str());
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...