|
|
|
@ -41,8 +41,9 @@ class ConcatOp : public framework::OperatorWithKernel {
|
|
|
|
|
static_cast<int64_t>(ins[0].size()));
|
|
|
|
|
|
|
|
|
|
const size_t n = ins.size();
|
|
|
|
|
|
|
|
|
|
PADDLE_ENFORCE_GT(n, 0, "Input tensors count should > 0.");
|
|
|
|
|
PADDLE_ENFORCE_GT(n, 0,
|
|
|
|
|
"ShapeError: Input tensors count should > 0. But "
|
|
|
|
|
"recevied inputs' length is 0.");
|
|
|
|
|
if (n == 1) {
|
|
|
|
|
VLOG(3) << "Warning: concat op have only one input, may waste memory";
|
|
|
|
|
}
|
|
|
|
@ -66,9 +67,14 @@ class ConcatOp : public framework::OperatorWithKernel {
|
|
|
|
|
ctx->IsRuntime() || (out_dims[j] > 0 && ins[i][j] > 0);
|
|
|
|
|
if (check_shape) {
|
|
|
|
|
// check all shape in run time
|
|
|
|
|
PADDLE_ENFORCE_EQ(out_dims[j], ins[i][j],
|
|
|
|
|
"Input tensors should have the same "
|
|
|
|
|
"elements except the specify axis.");
|
|
|
|
|
PADDLE_ENFORCE_EQ(
|
|
|
|
|
out_dims[j], ins[i][j],
|
|
|
|
|
"ShapeError: Input tensors should have same "
|
|
|
|
|
"dimensions(or specific dimension = -1) except the axis. "
|
|
|
|
|
"But recevied axis = %s, input[0]'s shape = "
|
|
|
|
|
"[%s], input[%s]'s shape = [%s], the \"%s\" "
|
|
|
|
|
"dimension of input[%s] is unexpected",
|
|
|
|
|
axis, ins[0], i, ins[j], j, i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|