From eb15e9a7aa51cfda6441b0648efdc3db76b4546d Mon Sep 17 00:00:00 2001 From: zhupengyang Date: Thu, 26 May 2022 16:57:24 +0800 Subject: [PATCH] enhance yolo_box_fuse_pass (#42926) --- paddle/fluid/framework/ir/yolo_box_fuse_pass.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/framework/ir/yolo_box_fuse_pass.cc b/paddle/fluid/framework/ir/yolo_box_fuse_pass.cc index c974d334a8d..20075a49749 100644 --- a/paddle/fluid/framework/ir/yolo_box_fuse_pass.cc +++ b/paddle/fluid/framework/ir/yolo_box_fuse_pass.cc @@ -199,9 +199,11 @@ void YoloBoxFusePass::ApplyImpl(ir::Graph* graph) const { GET_IR_NODE(nms_out_rois_num); #undef GET_IR_NODE + auto* block = yolo_box0->Op()->Block(); + // create yolo_box_head #define CREATE_YOLO_BOX_HEAD(idx_) \ - framework::OpDesc yolo_box_head##idx_##_op_desc; \ + framework::OpDesc yolo_box_head##idx_##_op_desc(block); \ yolo_box_head##idx_##_op_desc.SetType("yolo_box_head"); \ yolo_box_head##idx_##_op_desc.SetInput("X", \ {yolo_box##idx_##_in_x->Name()}); \ @@ -222,7 +224,7 @@ void YoloBoxFusePass::ApplyImpl(ir::Graph* graph) const { #undef CREATE_YOLO_BOX_HEAD // create yolo_box_post - framework::OpDesc yolo_box_post_op_desc; + framework::OpDesc yolo_box_post_op_desc(block); yolo_box_post_op_desc.SetType("yolo_box_post"); yolo_box_post_op_desc.SetInput("Boxes0", {yolo_box0_out_boxes->Name()}); yolo_box_post_op_desc.SetInput("Boxes1", {yolo_box1_out_boxes->Name()}); -- GitLab