未验证 提交 3a9ae28d 编写于 作者: B Bai Yifan 提交者: GitHub

fix assert,test=develop (#17445)

上级 b02f2aff
......@@ -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<T>()(real_log(match_x));
match_x_[idx] = match_x;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册