!11150 Release GIL lock when SyncAsNumpy and run bprop graph in PyNative mod

From: @HulkTang
Reviewed-by: 
Signed-off-by:
pull/11150/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 645bd9de89

@ -420,7 +420,7 @@ void Executor::RunOpsInGraph(const SessionPtr &session, const GraphId &graph_id,
task->session_ = session;
task->graph_id_ = graph_id;
task->input_tensors_ = inputs;
RunTask(task, true);
RunTask(task, true, true);
*outputs = task->outputs_;
}

@ -259,11 +259,13 @@ py::tuple TensorPy::GetPyTupleShape(const Tensor &tensor) {
}
py::array TensorPy::SyncAsNumpy(const Tensor &tensor) {
if (tensor.NeedWait()) {
{
py::gil_scoped_release gil_release;
tensor.Wait();
if (tensor.NeedWait()) {
tensor.Wait();
}
tensor.data_sync();
}
tensor.data_sync();
return AsNumpy(tensor);
}

Loading…
Cancel
Save