From e3c6812b81891461af9472d5d22d277bf2e9b691 Mon Sep 17 00:00:00 2001 From: Liufang Sang Date: Tue, 12 May 2020 22:57:45 -0500 Subject: [PATCH] fix error message in accuracy_op.h (#24416) test=release/1.8 (#24432) --- paddle/fluid/operators/metrics/accuracy_op.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) mode change 100755 => 100644 paddle/fluid/operators/metrics/accuracy_op.h diff --git a/paddle/fluid/operators/metrics/accuracy_op.h b/paddle/fluid/operators/metrics/accuracy_op.h old mode 100755 new mode 100644 index 803244dd48e..94e5bf8257e --- a/paddle/fluid/operators/metrics/accuracy_op.h +++ b/paddle/fluid/operators/metrics/accuracy_op.h @@ -50,7 +50,11 @@ class AccuracyKernel : public framework::OpKernel { int num_correct = 0; // assume inference is already the topk of the output for (size_t i = 0; i < num_samples; ++i) { - PADDLE_ENFORCE_GE(label_data[i], 0, "label must >= 0"); + PADDLE_ENFORCE_GE( + label_data[i], 0, + platform::errors::InvalidArgument( + "label of AccuracyOp must >= 0, But received label[%d] is %d", i, + label_data[i])); for (size_t j = 0; j < class_dim; ++j) { if (indices_data[i * class_dim + j] == label_data[i]) { ++num_correct; -- GitLab