From 6859d92e2bb2a4767ea7798bba91c303bf7dd21a Mon Sep 17 00:00:00 2001 From: Zhang Lei Date: Wed, 11 Dec 2019 12:04:54 -0800 Subject: [PATCH] Make sure fenced tensor could not reuse other tensor. (#2561) Fix random error caused by this. --- onnxruntime/core/framework/allocation_planner.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/onnxruntime/core/framework/allocation_planner.cc b/onnxruntime/core/framework/allocation_planner.cc index 2b287c89f2..3348f46fd4 100644 --- a/onnxruntime/core/framework/allocation_planner.cc +++ b/onnxruntime/core/framework/allocation_planner.cc @@ -325,6 +325,7 @@ class PlannerImpl { auto p_required_buffer_shape = context_.GetShape(output_arg); if (nullptr == p_required_buffer_shape) return false; auto& required_memory_info = AllocPlan(output_arg.Name()).location; + if (HasFence(&output_arg)) return false; for (auto it = freelist_.begin(); it != freelist_.end(); ++it) { size_t reusable = static_cast(it->ml_value);