Skip to content

Commit

Permalink
Update pythin bindings for options (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
xadupre authored and pranavsharma committed Nov 30, 2018
1 parent 728c3c0 commit 1ea32a0
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions onnxruntime/python/onnxruntime_pybind_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,37 @@ void addObjectMethods(py::module& m) {
py::add_ostream_redirect(m, "onnxruntime_ostream_redirect");
py::class_<SessionOptions>(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_<RunOptions>(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_<ModelMetadata>(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
Expand Down

0 comments on commit 1ea32a0

Please sign in to comment.