| 112 | } |
| 113 | |
| 114 | int LITE_register_parse_info_func( |
| 115 | const char* info_type, const LiteParseInfoFunc parse_func) { |
| 116 | LITE_CAPI_BEGIN(); |
| 117 | LITE_ASSERT(info_type && parse_func, "The ptr pass to LITE api is null"); |
| 118 | auto lite_func = |
| 119 | [parse_func]( |
| 120 | const void* info_data, size_t info_size, |
| 121 | const std::string model_name, lite::Config& config, |
| 122 | lite::NetworkIO& network_io, |
| 123 | std::unordered_map<std::string, lite::LiteAny>& separate_config_map, |
| 124 | std::string& extra_info) { |
| 125 | LITE_MARK_USED_VAR(extra_info); |
| 126 | size_t nr_threads = 1; |
| 127 | int device_id = 0, is_cpu_inplace_mode = false, use_tensorrt = false; |
| 128 | LiteNetworkIO c_io; |
| 129 | LiteConfig c_config; |
| 130 | auto ret = parse_func( |
| 131 | info_data, info_size, model_name.c_str(), &c_config, &c_io, |
| 132 | &device_id, &nr_threads, &is_cpu_inplace_mode, &use_tensorrt); |
| 133 | config = convert_to_lite_config(c_config); |
| 134 | network_io = convert_to_lite_io(c_io); |
| 135 | if (device_id != 0) { |
| 136 | separate_config_map["device_id"] = device_id; |
| 137 | } |
| 138 | if (nr_threads != 1) { |
| 139 | separate_config_map["nr_threads"] = |
| 140 | static_cast<uint32_t>(nr_threads); |
| 141 | } |
| 142 | if (is_cpu_inplace_mode != false) { |
| 143 | separate_config_map["is_inplace_mode"] = is_cpu_inplace_mode; |
| 144 | } |
| 145 | if (use_tensorrt != false) { |
| 146 | separate_config_map["use_tensorrt"] = use_tensorrt; |
| 147 | } |
| 148 | return ret; |
| 149 | }; |
| 150 | lite::register_parse_info_func(info_type, lite_func); |
| 151 | LITE_CAPI_END(); |
| 152 | } |
| 153 | |
| 154 | int LITE_set_loader_lib_path(const char* loader_path) { |
| 155 | LITE_CAPI_BEGIN(); |
nothing calls this directly
no test coverage detected