diff --git a/paddle/fluid/framework/ir/yolo_box_fuse_pass.cc b/paddle/fluid/framework/ir/yolo_box_fuse_pass.cc index c974d334a8de0b0f90fa8e6a666518d00eaafc7e..20075a49749f75fac347cb46b1ba2e5767f44975 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()});