Scoped GIL release in run_with_iobinding (#11248)

This commit is contained in:
Dmitri Smirnov 2022-04-18 13:07:45 -07:00 committed by GitHub
parent dec99657a1
commit 98faaa7e2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1547,6 +1547,8 @@ including arg name, arg type (contains both type and shape).)pbdoc")
py::return_value_policy::reference_internal)
.def("run_with_iobinding", [](PyInferenceSession* sess, SessionIOBinding& io_binding, RunOptions* run_options = nullptr) -> void {
Status status;
// release GIL to allow multiple python threads to invoke Run() in parallel.
py::gil_scoped_release release;
if (!run_options)
status = sess->GetSessionHandle()->Run(*io_binding.Get());
else