Caffe2 - C++ API
A deep learning, cross platform ML framework
device.cc
1 #include "caffe2/onnx/device.h"
2 
3 #include <cstdlib>
4 #include <unordered_map>
5 
6 namespace caffe2 { namespace onnx {
7 static const std::unordered_map<std::string, DeviceType> kDeviceMap = {
8  {"CPU", DeviceType::CPU},
9  {"CUDA", DeviceType::CUDA}
10 };
11 
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());
16 }
17 }}
18 
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13