From 1ea32a097a362ab98d7e3a7914042c8d03293336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Dupr=C3=A9?= Date: Fri, 30 Nov 2018 02:03:09 +0100 Subject: [PATCH] Update pythin bindings for options (#14) --- .../python/onnxruntime_pybind_state.cc | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/onnxruntime/python/onnxruntime_pybind_state.cc b/onnxruntime/python/onnxruntime_pybind_state.cc index d2c7d0b52c..d1889afd8f 100644 --- a/onnxruntime/python/onnxruntime_pybind_state.cc +++ b/onnxruntime/python/onnxruntime_pybind_state.cc @@ -231,21 +231,37 @@ void addObjectMethods(py::module& m) { py::add_ostream_redirect(m, "onnxruntime_ostream_redirect"); py::class_(m, "SessionOptions", R"pbdoc(Configuration information for a session.)pbdoc") .def(py::init()) + .def_readwrite("enable_mem_pattern", &SessionOptions::enable_mem_pattern, + R"pbdoc(Enables the memory pattern optimization. +The idea is if the input shapes are the same, we could trace the internal memory allocation +and generate a memory pattern for future request. So next time we could just do one allocation +with a big chunk for all the internal memory allocation. Default is true.)pbdoc") + .def_readwrite("enable_cpu_mem_arena", &SessionOptions::enable_cpu_mem_arena, + R"pbdoc(Enables the memory arena on CPU. Arena may pre-allocate memory for future usage. +Set this option to false if you don't want it. Default is True.)pbdoc") .def_readwrite("enable_profiling", &SessionOptions::enable_profiling, - R"pbdoc(Enable profiling for this session.)pbdoc") - .def_readwrite("profile_file_prefix", &SessionOptions::profile_file_prefix, - R"pbdoc(The prefix of the profile file. The current time will be appended to the file name.)pbdoc") + R"pbdoc(Enable profiling for this session. Default is false.)pbdoc") + .def_readwrite("enable_sequential_execution", &SessionOptions::enable_sequential_execution, + R"pbdoc(Enables sequential execution, disables parallel execution. Default is true.)pbdoc") + .def_readwrite("max_num_graph_transformation_steps", &SessionOptions::max_num_graph_transformation_steps, + R"pbdoc(Runs optimization steps on the execution graph. Default is 5.)pbdoc") .def_readwrite("session_logid", &SessionOptions::session_logid, R"pbdoc(Logger id to use for session output.)pbdoc") .def_readwrite("session_log_verbosity_level", &SessionOptions::session_log_verbosity_level, - R"pbdoc(Applies to session load, initialization, etc.)pbdoc"); + R"pbdoc(Applies to session load, initialization, etc. Default is 0.)pbdoc") + .def_readwrite("session_thread_pool_size", &SessionOptions::session_thread_pool_size, + R"pbdoc(How many threads in the session thread pool. Default is 0 to let onnxruntime choose. +This parameter is unused unless *enable_sequential_execution* is false.)pbdoc"); py::class_(m, "RunOptions", R"pbdoc(Configuration information for a single Run.)pbdoc") .def(py::init()) .def_readwrite("run_log_verbosity_level", &RunOptions::run_log_verbosity_level, "Applies to a particular Run() invocation.") .def_readwrite("run_tag", &RunOptions::run_tag, - "To identify logs generated by a particular Run() invocation."); + "To identify logs generated by a particular Run() invocation.") + .def_readwrite("terminate", &RunOptions::terminate, + R"pbdoc(Set to True to terminate any currently executing calls that are using this +RunOptions instance. The individual calls will exit gracefully and return an error status.)pbdoc"); py::class_(m, "ModelMetadata", R"pbdoc(Pre-defined and custom metadata about the model. It is usually used to identify the model used to run the prediction and