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
revert-21172-masked_select_api
Youwei Song 5 years ago committed by liym27
parent 07e6a94268
commit 4d0f5ab1a8

@ -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;
}

Loading…
Cancel
Save