Skip to content

Commit d31138a

Browse files
committed
refine roi align infer shape. test=release/1.4
1 parent 1237dfa commit d31138a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

paddle/fluid/operators/roi_align_op.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ class ROIAlignOp : public framework::OperatorWithKernel {
3737
PADDLE_ENFORCE(rois_dims.size() == 2,
3838
"ROIs should be a 2-D LoDTensor of shape (num_rois, 4)"
3939
"given as [[x1, y1, x2, y2], ...].");
40-
PADDLE_ENFORCE(rois_dims[1] == 4,
41-
"ROIs should be a 2-D LoDTensor of shape (num_rois, 4)"
42-
"given as [[x1, y1, x2, y2], ...].");
40+
if (ctx->IsRuntime()) {
41+
PADDLE_ENFORCE(rois_dims[1] == 4,
42+
"ROIs should be a 2-D LoDTensor of shape (num_rois, 4)"
43+
"given as [[x1, y1, x2, y2], ...].");
44+
}
4345
int pooled_height = ctx->Attrs().Get<int>("pooled_height");
4446
int pooled_width = ctx->Attrs().Get<int>("pooled_width");
4547
float spatial_scale = ctx->Attrs().Get<float>("spatial_scale");

0 commit comments

Comments
 (0)