!21894 Fix VM random failed issue
Merge pull request !21894 from chenweifeng/vm-random-failed
This commit is contained in:
commit
562088ad1b
|
@ -380,8 +380,19 @@ void Executor::RunGraphAsync(const SessionPtr &session, const GraphId &graph_id,
|
|||
session->CreateOutputTensors(graph_id, inputs, outputs, &task->tensor_to_node_);
|
||||
// maintain a copy of output vector
|
||||
task->outputs_ = *outputs;
|
||||
// sync run graph without output tensor(int dataset graph) or the graph require gil.
|
||||
if ((!TensorInVector(outputs) && !graph->HasPostGraph()) || graph->is_need_gil()) {
|
||||
|
||||
// Run graph synchronously when the graph require gil.
|
||||
if (graph != nullptr && graph->is_need_gil()) {
|
||||
std::unique_lock<std::mutex> lock(reenter_mutex_);
|
||||
reenter_cond_var_.wait(lock, [&graph] { return graph->IsPreGraphFinished(); });
|
||||
MsException::Instance().CheckException();
|
||||
task->sync_run_ = true;
|
||||
RunTask(task, true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// sync run graph without output tensor(int dataset graph)
|
||||
if ((!TensorInVector(outputs) && !graph->HasPostGraph())) {
|
||||
task->sync_run_ = true;
|
||||
RunTask(task, true, true);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue