File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
paddle/fluid/operators/detection Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -60,14 +60,15 @@ class BoxCoderOp : public framework::OperatorWithKernel {
60
60
} else if (code_type == BoxCodeType::kDecodeCenterSize ) {
61
61
PADDLE_ENFORCE_EQ (target_box_dims.size (), 3 ,
62
62
" The rank of Input TargetBox must be 3" );
63
- if (axis == 0 ) {
64
- PADDLE_ENFORCE_EQ (target_box_dims[1 ], prior_box_dims[0 ]);
65
- } else if (axis == 1 ) {
66
- PADDLE_ENFORCE_EQ (target_box_dims[0 ], prior_box_dims[0 ]);
67
- } else {
68
- PADDLE_THROW (" axis must be 0 or 1." );
63
+ PADDLE_ENFORCE (axis == 0 || axis == 1 , " axis must be 0 or 1" );
64
+ if (ctx->IsRuntime ()) {
65
+ if (axis == 0 ) {
66
+ PADDLE_ENFORCE_EQ (target_box_dims[1 ], prior_box_dims[0 ]);
67
+ } else if (axis == 1 ) {
68
+ PADDLE_ENFORCE_EQ (target_box_dims[0 ], prior_box_dims[0 ]);
69
+ }
70
+ PADDLE_ENFORCE_EQ (target_box_dims[2 ], prior_box_dims[1 ]);
69
71
}
70
- PADDLE_ENFORCE_EQ (target_box_dims[2 ], prior_box_dims[1 ]);
71
72
ctx->ShareDim (" TargetBox" , /* ->*/ " OutputBox" );
72
73
}
73
74
You can’t perform that action at this time.
0 commit comments