option_pybind.cc 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #include "ultra_infer/pybind/main.h"
  15. #include "ultra_infer/runtime/backends/lite/option.h"
  16. namespace ultra_infer {
  17. void BindLiteOption(pybind11::module &m) {
  18. pybind11::class_<LiteBackendOption>(m, "LiteBackendOption")
  19. .def(pybind11::init())
  20. .def_readwrite("power_mode", &LiteBackendOption::power_mode)
  21. .def_readwrite("cpu_threads", &LiteBackendOption::cpu_threads)
  22. .def_readwrite("enable_fp16", &LiteBackendOption::enable_fp16)
  23. .def_readwrite("device", &LiteBackendOption::device)
  24. .def_readwrite("optimized_model_dir",
  25. &LiteBackendOption::optimized_model_dir)
  26. .def_readwrite(
  27. "nnadapter_subgraph_partition_config_path",
  28. &LiteBackendOption::nnadapter_subgraph_partition_config_path)
  29. .def_readwrite(
  30. "nnadapter_subgraph_partition_config_buffer",
  31. &LiteBackendOption::nnadapter_subgraph_partition_config_buffer)
  32. .def_readwrite("nnadapter_context_properties",
  33. &LiteBackendOption::nnadapter_context_properties)
  34. .def_readwrite("nnadapter_model_cache_dir",
  35. &LiteBackendOption::nnadapter_model_cache_dir)
  36. .def_readwrite("nnadapter_mixed_precision_quantization_config_path",
  37. &LiteBackendOption::
  38. nnadapter_mixed_precision_quantization_config_path)
  39. .def_readwrite("nnadapter_dynamic_shape_info",
  40. &LiteBackendOption::nnadapter_dynamic_shape_info)
  41. .def_readwrite("nnadapter_device_names",
  42. &LiteBackendOption::nnadapter_device_names)
  43. .def_readwrite("device_id", &LiteBackendOption::device_id)
  44. .def_readwrite("kunlunxin_l3_workspace_size",
  45. &LiteBackendOption::kunlunxin_l3_workspace_size)
  46. .def_readwrite("kunlunxin_locked", &LiteBackendOption::kunlunxin_locked)
  47. .def_readwrite("kunlunxin_autotune",
  48. &LiteBackendOption::kunlunxin_autotune)
  49. .def_readwrite("kunlunxin_autotune_file",
  50. &LiteBackendOption::kunlunxin_autotune_file)
  51. .def_readwrite("kunlunxin_precision",
  52. &LiteBackendOption::kunlunxin_precision)
  53. .def_readwrite("kunlunxin_gm_default_size",
  54. &LiteBackendOption::kunlunxin_gm_default_size)
  55. .def_readwrite("kunlunxin_adaptive_seqlen",
  56. &LiteBackendOption::kunlunxin_adaptive_seqlen)
  57. .def_readwrite("kunlunxin_enable_multi_stream",
  58. &LiteBackendOption::kunlunxin_enable_multi_stream);
  59. }
  60. } // namespace ultra_infer