未验证 提交 ebc6959c 编写于 作者: W wangxinxin08 提交者: GitHub

modify infershape of yolo_box (#40056)

* modify infershape of yolo_box
上级 7ef61789
...@@ -102,7 +102,12 @@ class YoloBoxOp : public framework::OperatorWithKernel { ...@@ -102,7 +102,12 @@ class YoloBoxOp : public framework::OperatorWithKernel {
"But received class_num (%s)", "But received class_num (%s)",
class_num)); class_num));
int box_num = dim_x[2] * dim_x[3] * anchor_num; int box_num;
if ((dim_x[2] > 0 && dim_x[3] > 0) || ctx->IsRuntime()) {
box_num = dim_x[2] * dim_x[3] * anchor_num;
} else {
box_num = -1;
}
std::vector<int64_t> dim_boxes({dim_x[0], box_num, 4}); std::vector<int64_t> dim_boxes({dim_x[0], box_num, 4});
ctx->SetOutputDim("Boxes", phi::make_ddim(dim_boxes)); ctx->SetOutputDim("Boxes", phi::make_ddim(dim_boxes));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册