diff --git a/python/paddle/nn/functional/loss.py b/python/paddle/nn/functional/loss.py index 1450101206244a1009db96b1e020f2319022c70c..c67f578df22f72292adb9dcc5ee62a31a063f72b 100755 --- a/python/paddle/nn/functional/loss.py +++ b/python/paddle/nn/functional/loss.py @@ -1807,7 +1807,7 @@ def cross_entropy(input, valid_label = paddle.where(label == ignore_index, paddle.zeros_like(label), label) ignore_weight_mask = paddle.cast( - (label != ignore_index), input.dtype) + (label != ignore_index), input.dtype) if ignore_weight_mask.ndim > 1 and ignore_weight_mask.shape[ -1] == 1: ignore_weight_mask = paddle.squeeze(ignore_weight_mask, -1)