From be82de4c79d074ef121794986e49f09f55f9b8fb Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Thu, 28 May 2020 10:25:29 +0800 Subject: [PATCH] polish two error message, test=develop (#24778) --- .../sequence_ops/sequence_softmax_cudnn_op.cu.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/operators/sequence_ops/sequence_softmax_cudnn_op.cu.cc b/paddle/fluid/operators/sequence_ops/sequence_softmax_cudnn_op.cu.cc index 5853639586..b33d87e644 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_softmax_cudnn_op.cu.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_softmax_cudnn_op.cu.cc @@ -33,12 +33,17 @@ class SequenceSoftmaxCUDNNKernel : public framework::OpKernel { auto& dims = x->dims(); const size_t level = lod.size() - 1; - PADDLE_ENFORCE_EQ(dims[0], static_cast(lod[level].back()), - "The first dimension of Input(X) should be equal to the " - "sum of all sequences' lengths."); + PADDLE_ENFORCE_EQ( + dims[0], static_cast(lod[level].back()), + platform::errors::InvalidArgument( + "The first dimension of Input(X) should be equal to the sum of all " + "sequences' lengths. But received first dimension of Input(X) is " + "%d, the sum of all sequences' lengths is %d.", + dims[0], static_cast(lod[level].back()))); PADDLE_ENFORCE_EQ(dims[0], x->numel(), - "The width of each timestep in Input(X) of " - "SequenceSoftmaxOp should be 1."); + platform::errors::InvalidArgument( + "The width of each timestep in Input(X) of " + "SequenceSoftmaxOp should be 1.")); out->mutable_data(ctx.GetPlace()); for (int i = 0; i < static_cast(lod[level].size()) - 1; ++i) { -- GitLab