提交 4d0f5ab1 编写于 作者: Y Youwei Song 提交者: liym27

add axis check for concat op (#21288)

* add axis check for concat op
test=develop

* fix PADDLE_ENFORCE format
test=develop

* move to ComputeAxis for InferShape check
test=develop
上级 07e6a942
......@@ -61,6 +61,11 @@ static inline framework::DDim ComputeAndCheckShape(
}
static inline int64_t ComputeAxis(int64_t axis, int64_t rank) {
PADDLE_ENFORCE_EQ(
axis >= -rank && axis < rank, true,
platform::errors::InvalidArgument(
"The axis is expected to be in range of [%d, %d), but got %d", -rank,
rank, axis));
if (axis < 0) {
axis = axis + rank;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册