未验证 提交 5feadc0b 编写于 作者: X XiangGao 提交者: GitHub

fix trace heap overflow (#49548)

上级 ec857b85
......@@ -4033,13 +4033,22 @@ void TraceInferMeta(
x_dims.size(),
2,
phi::errors::OutOfRange(
"Input's dim is out of range (expected at least 2, but got %ld).",
"Input(x)'s dim is out of range (expected at least 2, but got %ld).",
x_dims.size()));
PADDLE_ENFORCE_LT(
dim1_,
x_dims.size(),
phi::errors::OutOfRange(
"Attr(dim1) is out of range (expected to be in range of [%ld, "
"axis1 is out of range (expected to be in range of [%ld, "
"%ld], but got %ld).",
-(x_dims.size()),
(x_dims.size() - 1),
dim1));
PADDLE_ENFORCE_GE(
dim1_,
0,
phi::errors::OutOfRange(
"axis1 is out of range (expected to be in range of [%ld, "
"%ld], but got %ld).",
-(x_dims.size()),
(x_dims.size() - 1),
......@@ -4048,7 +4057,16 @@ void TraceInferMeta(
dim2_,
x_dims.size(),
phi::errors::OutOfRange(
"Attr(dim2) is out of range (expected to be in range of [%ld, "
"axis2 is out of range (expected to be in range of [%ld, "
"%ld], but got %ld).",
-(x_dims.size()),
(x_dims.size() - 1),
dim2));
PADDLE_ENFORCE_GE(
dim2_,
0,
phi::errors::OutOfRange(
"axis2 is out of range (expected to be in range of [%ld, "
"%ld], but got %ld).",
-(x_dims.size()),
(x_dims.size() - 1),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册