Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python bindings for options #14

Merged
merged 3 commits into from
Nov 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
jywu-msft marked this conversation as resolved.
Show resolved Hide resolved
.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,
jywu-msft marked this conversation as resolved.
Show resolved Hide resolved
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