未验证 提交 1fc242a7 编写于 作者: W wangguanzhong 提交者: GitHub

refine infer shape in box decoder and assign op, test=develop (#19118)

上级 29d87812
...@@ -57,17 +57,19 @@ class BoxDecoderAndAssignOp : public framework::OperatorWithKernel { ...@@ -57,17 +57,19 @@ class BoxDecoderAndAssignOp : public framework::OperatorWithKernel {
"The rank of Input of TargetBox must be 2"); "The rank of Input of TargetBox must be 2");
PADDLE_ENFORCE_EQ(box_score_dims.size(), 2, PADDLE_ENFORCE_EQ(box_score_dims.size(), 2,
"The rank of Input of BoxScore must be 2"); "The rank of Input of BoxScore must be 2");
PADDLE_ENFORCE_EQ(prior_box_dims[0], target_box_dims[0], if (ctx->IsRuntime()) {
"The first dim of prior_box and target_box is roi nums " PADDLE_ENFORCE_EQ(prior_box_dims[0], target_box_dims[0],
"and should be same!"); "The first dim of prior_box and target_box is roi nums "
PADDLE_ENFORCE_EQ(prior_box_dims[0], box_score_dims[0], "and should be same!");
"The first dim of prior_box and box_score is roi nums " PADDLE_ENFORCE_EQ(prior_box_dims[0], box_score_dims[0],
"and should be same!"); "The first dim of prior_box and box_score is roi nums "
PADDLE_ENFORCE_EQ(target_box_dims[1], box_score_dims[1] * prior_box_dims[1], "and should be same!");
"The shape of target_box is [N, classnum * 4], The shape " PADDLE_ENFORCE_EQ(
"of box_score is [N, classnum], The shape of prior_box " target_box_dims[1], box_score_dims[1] * prior_box_dims[1],
"is [N, 4]"); "The shape of target_box is [N, classnum * 4], The shape "
"of box_score is [N, classnum], The shape of prior_box "
"is [N, 4]");
}
ctx->SetOutputDim("DecodeBox", framework::make_ddim({target_box_dims[0], ctx->SetOutputDim("DecodeBox", framework::make_ddim({target_box_dims[0],
target_box_dims[1]})); target_box_dims[1]}));
ctx->ShareLoD("TargetBox", /*->*/ "DecodeBox"); ctx->ShareLoD("TargetBox", /*->*/ "DecodeBox");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册