From 3a9ae28d32121bb526611fd5153f9b1d15267389 Mon Sep 17 00:00:00 2001 From: Bai Yifan Date: Fri, 17 May 2019 09:52:14 +0800 Subject: [PATCH] fix assert,test=develop (#17445) --- paddle/fluid/operators/cross_entropy_op.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/operators/cross_entropy_op.h b/paddle/fluid/operators/cross_entropy_op.h index 89bacfc33ed..309ba46cfa3 100644 --- a/paddle/fluid/operators/cross_entropy_op.h +++ b/paddle/fluid/operators/cross_entropy_op.h @@ -154,9 +154,9 @@ struct HardLabelCrossEntropyForwardFunctor { HOSTDEVICE void operator()(int64_t idx) const { auto label = label_[idx]; - PADDLE_ASSERT_MSG(label >= 0 && label < feature_size_, - "The label is out of the range.", label); if (label != ignore_index_) { + PADDLE_ASSERT_MSG(label >= 0 && label < feature_size_, + "The label is out of the range.", label); auto match_x = x_[idx * feature_size_ + label]; y_[idx] = -math::TolerableValue()(real_log(match_x)); match_x_[idx] = match_x; -- GitLab