Skip to content

Commit 25fec63

Browse files
authored
Merge pull request #16383 from phlrain/pick_concat
Merge pull request #16258 from phlrain/fix_concat_1
2 parents 01d4c39 + b66b925 commit 25fec63

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

paddle/fluid/operators/concat_op.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,19 @@ class ConcatOp : public framework::OperatorWithKernel {
5050
if (j == axis) {
5151
out_dims[axis] += ins[i][j];
5252
} else {
53-
PADDLE_ENFORCE_EQ(out_dims[j], ins[i][j],
54-
"Input tensors should have the same "
55-
"elements except the specify axis.");
53+
if (ctx->IsRuntime()) {
54+
// check all shape in run time
55+
PADDLE_ENFORCE_EQ(out_dims[j], ins[i][j],
56+
"Input tensors should have the same "
57+
"elements except the specify axis.");
58+
} else {
59+
// not check -1 with other in compile time
60+
if (out_dims[j] > 0 && ins[i][j] > 0) {
61+
PADDLE_ENFORCE_EQ(out_dims[j], ins[i][j],
62+
"Input tensors should have the same "
63+
"elements except the specify axis.");
64+
}
65+
}
5666
}
5767
}
5868
}

0 commit comments

Comments
 (0)