| 26 | using EndToken = std::variant<std::string, std::vector<std::string>, std::vector<size_t>>; |
| 27 | |
| 28 | class ComputeTypeResolver { |
| 29 | private: |
| 30 | const std::string _device; |
| 31 | |
| 32 | public: |
| 33 | ComputeTypeResolver(std::string device) |
| 34 | : _device(std::move(device)) { |
| 35 | } |
| 36 | |
| 37 | ComputeType |
| 38 | operator()(const std::string& compute_type) const { |
| 39 | return str_to_compute_type(compute_type); |
| 40 | } |
| 41 | |
| 42 | ComputeType |
| 43 | operator()(const std::unordered_map<std::string, std::string>& compute_type) const { |
| 44 | auto it = compute_type.find(_device); |
| 45 | if (it == compute_type.end()) |
| 46 | return ComputeType::DEFAULT; |
| 47 | return operator()(it->second); |
| 48 | } |
| 49 | }; |
| 50 | |
| 51 | class DeviceIndexResolver { |
| 52 | public: |