From 6d0370d27a1523fcebeb20d3ffa96a23b99e9820 Mon Sep 17 00:00:00 2001 From: chengduoZH Date: Tue, 18 Sep 2018 10:41:19 +0800 Subject: [PATCH] fix warning --- paddle/fluid/operators/cross_entropy_op.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/cross_entropy_op.h b/paddle/fluid/operators/cross_entropy_op.h index 03974a7fc5..f123e11542 100644 --- a/paddle/fluid/operators/cross_entropy_op.h +++ b/paddle/fluid/operators/cross_entropy_op.h @@ -86,10 +86,10 @@ class XeGradFunctor { auto x_is_true_offset = sample_id * num_classes_ + label_[sample_id]; for (size_t x_offset = sample_id * num_classes_; x_offset < (sample_id + 1) * num_classes_; ++x_offset) { - dx_[x_offset] = - (x_offset != x_is_true_offset || label_[sample_id] == ignore_index_) - ? static_cast(0) - : -dy_[sample_id] / x_[x_offset]; + dx_[x_offset] = (x_offset != x_is_true_offset || + label_[sample_id] == static_cast(ignore_index_)) + ? static_cast(0) + : -dy_[sample_id] / x_[x_offset]; } } -- GitLab