From 43c4a00d032569be67b465d9136305f4af50b615 Mon Sep 17 00:00:00 2001 From: smallv0221 <397551318@qq.com> Date: Thu, 24 Sep 2020 13:21:49 +0000 Subject: [PATCH] API(Compute) error message enhancement on line 44, 50, 53. --- paddle/fluid/operators/sequence_ops/sequence_pool_op.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/operators/sequence_ops/sequence_pool_op.h b/paddle/fluid/operators/sequence_ops/sequence_pool_op.h index 8fe68deca6..4dafaa2b63 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_pool_op.h +++ b/paddle/fluid/operators/sequence_ops/sequence_pool_op.h @@ -42,14 +42,17 @@ class SequencePoolKernel : public framework::OpKernel { "Input(X) Tensor of SequencePoolOp " "does not contain LoD information.")); PADDLE_ENFORCE_LE(lod_level, 2UL, - "The lod level of input shall be no more than 2."); + platform::errors::InvalidArgument( + "The lod level of input shall be no more than 2.")); PADDLE_ENFORCE_GE( dims[0], /*batch size = */ static_cast(lod[lod_level - 1].size() - 1), - "The first dimension of Input(X) must be large than batch size."); + platform::errors::InvalidArgument( + "The first dimension of Input(X) must be large than batch size.")); if (lod_level > 1UL) { PADDLE_ENFORCE_EQ(lod[0][lod[0].size() - 1], lod[1].size() - 1, - "The input lod information is illegal."); + platform::errors::InvalidArgument( + "The input lod information is illegal.")); framework::LoD out_lod; out_lod.push_back(lod[0]); out->set_lod(out_lod); -- GitLab