| 122 | } |
| 123 | |
| 124 | void GetDeviceType(const std::unordered_map<std::string, std::string>& params, std::string* device_type) { |
| 125 | std::string value; |
| 126 | if (Config::GetString(params, "device_type", &value)) { |
| 127 | std::transform(value.begin(), value.end(), value.begin(), Common::tolower); |
| 128 | if (value == std::string("cpu")) { |
| 129 | *device_type = "cpu"; |
| 130 | } else if (value == std::string("gpu")) { |
| 131 | *device_type = "gpu"; |
| 132 | } else { |
| 133 | Log::Fatal("Unknown device type %s", value.c_str()); |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | void GetTreeLearnerType(const std::unordered_map<std::string, std::string>& params, std::string* tree_learner) { |
| 139 | std::string value; |