From 6ceb29761b5efbf1e9f49ccb0d49fd73130ca83c Mon Sep 17 00:00:00 2001 From: Lei Cao Date: Sat, 11 Feb 2023 10:49:18 -0800 Subject: [PATCH] fix tests --- onnxruntime/core/framework/allocation_planner.cc | 2 ++ onnxruntime/test/framework/allocation_planner_test.cc | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/onnxruntime/core/framework/allocation_planner.cc b/onnxruntime/core/framework/allocation_planner.cc index 9d1773d4dc78b..8d63d23e36d71 100644 --- a/onnxruntime/core/framework/allocation_planner.cc +++ b/onnxruntime/core/framework/allocation_planner.cc @@ -1423,6 +1423,8 @@ class PlannerImpl { #if !defined(ORT_MINIMAL_BUILD) && defined(ORT_MEMORY_PROFILE) InplaceReuse(reused, current); #endif + } else if (IsNonTensor(*node_output)) { + AllocPlan(current).alloc_kind = AllocKind::kAllocate; } else if (!context_->IsParallelExecutionEnabled() && FindReusableTensor(*node_output, &reused)) { // Reuse an available (dead) buffer for this output, this is only for sequential execution. diff --git a/onnxruntime/test/framework/allocation_planner_test.cc b/onnxruntime/test/framework/allocation_planner_test.cc index ab300d43e48c6..dec210c90cafd 100644 --- a/onnxruntime/test/framework/allocation_planner_test.cc +++ b/onnxruntime/test/framework/allocation_planner_test.cc @@ -1845,9 +1845,9 @@ TEST_F(PlannerTest, ParaPlanCreation) { auto* exe_plan = const_cast(main_graph_session_state).GetExecutionPlan(); auto& per_value_plans = exe_plan->GetAllocationPlan(); InlinedHashMap reuse_pairs; - reuse_pairs.emplace("conv_0_out", "maxpool_out"); - reuse_pairs.emplace("conv_1_out", "conv_2_out"); - reuse_pairs.emplace("relu_1_out", "relu_2_out"); + reuse_pairs.emplace("conv_0_out", "relu_0_out"); // conv_0_out is reused by relu_0_out + reuse_pairs.emplace("conv_1_out", "relu_1_out"); // conv_1_out is reused by relu_1_out + reuse_pairs.emplace("conv_2_out", "relu_2_out"); // conv_2_out is reused by relu_2_out for (size_t i = 0; i < per_value_plans.size(); ++i) { auto& per_value_plan = per_value_plans[i]; if (per_value_plan.alloc_kind == AllocKind::kReuse) {