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 585363958696fa0d8ed1ffdc7b6fdaab26349b08..b33d87e644fd29a640a1ac9035ef2428d36973b6 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) {