From 61b3a94c2f7d89c3e6db9f3489577a47055534e1 Mon Sep 17 00:00:00 2001 From: HydrogenSulfate <490868991@qq.com> Date: Sun, 15 Aug 2021 16:16:23 +0800 Subject: [PATCH] Update loss.py --- python/paddle/nn/functional/loss.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/paddle/nn/functional/loss.py b/python/paddle/nn/functional/loss.py index 0c0e4ec938b..93c1820593e 100755 --- a/python/paddle/nn/functional/loss.py +++ b/python/paddle/nn/functional/loss.py @@ -1811,8 +1811,7 @@ def cross_entropy(input, .format(input.shape[-1], weight.shape[-1])) valid_label = paddle.where( label == ignore_index, - paddle.zeros([1], dtype=label.dtype), dtype=label.dtype), - label) + paddle.zeros([1], dtype=label.dtype), label) if (len(paddle.nonzero(valid_label < 0)) > 0) or ( len(paddle.nonzero(valid_label >= input.shape[-1])) > 0): invalid_label = paddle.gather_nd( -- GitLab