56 Device(
const std::string& device_type,
int device_id)
57 :
Device(device_type +
":" +
std::to_string(device_id)) {}
60 Device(
const std::string& type_colon_id)
102 std::vector<std::string> tokens;
104 if (tokens.size() == 2) {
106 if (device_name_lower ==
"cpu") {
108 }
else if (device_name_lower ==
"cuda") {
119 std::vector<std::string> tokens;
121 if (tokens.size() == 2) {
122 return std::stoi(tokens[1]);
Device()
Defalut constructor.
Definition: Device.h:45
bool operator!=(const Device &other) const
Definition: Device.h:71
void LogError(const char *format, const Args &... args)
Definition: Console.h:176
Definition: Optional.h:912
DeviceType GetType() const
Definition: Device.h:89
bool operator==(const Device &other) const
Definition: Device.h:66
int device_id_
Definition: Device.h:130
Device(const std::string &type_colon_id)
Constructor from string, e.g. "CUDA:0".
Definition: Device.h:60
DeviceType device_type_
Definition: Device.h:129
static int StringToDeviceId(const std::string &type_colon_id)
Definition: Device.h:118
DeviceType
Type for device.
Definition: Device.h:42
void AssertCPUDeviceIDIsZero()
Definition: Device.h:94
static DeviceType StringToDeviceType(const std::string &type_colon_id)
Definition: Device.h:101
Definition: PinholeCameraIntrinsic.cpp:35
void SplitString(std::vector< std::string > &tokens, const std::string &str, const std::string &delimiters, bool trim_empty_str)
Definition: Helper.cpp:43
Device(DeviceType device_type, int device_id)
Constructor with device specified.
Definition: Device.h:50
std::string ToString() const
Definition: Device.h:73
Device(const std::string &device_type, int device_id)
Constructor from device type string and device id.
Definition: Device.h:56
int GetID() const
Definition: Device.h:91
std::string ToLower(const std::string &str)
Convert string to the lower case.
Definition: Helper.cpp:72