Skip to content

Commit d1c5da2

Browse files
authored
Merge pull request #16889 from phlrain/pick_concat_new
Merge pull request #16787 from phlrain/fix_concat_shape_2
2 parents 1d28a49 + 35e5495 commit d1c5da2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

paddle/fluid/operators/concat_op.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,15 @@ class ConcatOp : public framework::OperatorWithKernel {
4949
for (size_t i = 1; i < n; i++) {
5050
for (size_t j = 0; j < in_zero_dims_size; j++) {
5151
if (j == axis) {
52-
out_dims[axis] += ins[i][j];
52+
if (ctx->IsRuntime()) {
53+
out_dims[axis] += ins[i][j];
54+
} else {
55+
if (ins[i][j] == -1) {
56+
out_dims[axis] = -1;
57+
} else {
58+
out_dims[axis] += ins[i][j];
59+
}
60+
}
5361
} else {
5462
if (ctx->IsRuntime()) {
5563
// check all shape in run time

0 commit comments

Comments
 (0)