MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle-Lite / BindLiteMobileConfig

Function BindLiteMobileConfig

lite/api/python/pybind/pybind.cc:192–233  ·  view source on GitHub ↗

TODO(sangoly): Should MobileConfig be renamed to LightConfig ??

Source from the content-addressed store, hash-verified

190
191// TODO(sangoly): Should MobileConfig be renamed to LightConfig ??
192void BindLiteMobileConfig(py::module *m) {
193 py::class_<MobileConfig> mobile_config(*m, "MobileConfig");
194
195 mobile_config.def(py::init<>())
196 .def("set_model_from_file", &MobileConfig::set_model_from_file)
197 .def("set_model_from_buffer",
198 overload_cast_<const std::string &>()(
199 &MobileConfig::set_model_from_buffer))
200 .def("set_model_dir", &MobileConfig::set_model_dir)
201 .def("model_dir", &MobileConfig::model_dir)
202 .def("set_model_buffer", &MobileConfig::set_model_buffer)
203 .def("is_model_from_memory", &MobileConfig::is_model_from_memory);
204#ifdef LITE_WITH_ARM
205 mobile_config.def("set_threads", &MobileConfig::set_threads)
206 .def("threads", &MobileConfig::threads)
207 .def("set_power_mode", &MobileConfig::set_power_mode)
208 .def("power_mode", &MobileConfig::power_mode);
209#endif
210 mobile_config
211 .def("set_opencl_binary_path_name",
212 &MobileConfig::set_opencl_binary_path_name)
213 .def("set_opencl_tune", &MobileConfig::set_opencl_tune)
214 .def("set_opencl_precision", &MobileConfig::set_opencl_precision);
215 mobile_config
216 .def("set_metal_use_mps",
217 &MobileConfig::set_metal_use_mps,
218 py::arg("flag") = true)
219 .def("set_metal_use_memory_reuse",
220 &MobileConfig::set_metal_use_memory_reuse)
221 .def("set_metal_lib_path", &MobileConfig::set_metal_lib_path);
222 mobile_config
223 .def("set_nnadapter_device_names",
224 &MobileConfig::set_nnadapter_device_names)
225 .def("set_nnadapter_context_properties",
226 &MobileConfig::set_nnadapter_context_properties)
227 .def("set_nnadapter_model_cache_dir",
228 &MobileConfig::set_nnadapter_model_cache_dir)
229 .def("set_nnadapter_dynamic_shape_info",
230 &MobileConfig::set_nnadapter_dynamic_shape_info)
231 .def("set_nnadapter_model_cache_buffers",
232 &MobileConfig::set_nnadapter_model_cache_buffers);
233}
234
235void BindLitePowerMode(py::module *m) {
236 py::enum_<PowerMode>(*m, "PowerMode")

Callers 1

BindLiteApiFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected