From 34092ab3b926e1123937ca4637e4d024e405ce32 Mon Sep 17 00:00:00 2001 From: chajchaj <57249073+chajchaj@users.noreply.github.com> Date: Fri, 26 Feb 2021 15:51:52 +0800 Subject: [PATCH] support label with float input of cross_entropy (#31178) * fix code style in nn/functional/loss.py, test=develop * fix code style in nn/functional/loss.py, test=develop --- python/paddle/nn/functional/loss.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/paddle/nn/functional/loss.py b/python/paddle/nn/functional/loss.py index bef604778ab..2fce7000927 100755 --- a/python/paddle/nn/functional/loss.py +++ b/python/paddle/nn/functional/loss.py @@ -1275,7 +1275,8 @@ def cross_entropy(input, fluid.data_feeder.check_variable_and_dtype( input, 'input', ['float32', 'float64'], 'softmax_cross_entropy') fluid.data_feeder.check_variable_and_dtype( - label, 'label', ['int32', 'int64'], 'softmax_cross_entropy') + label, 'label', ['int32', 'int64', 'float32', 'float64'], + 'softmax_cross_entropy') out = softmax_with_cross_entropy( input, label, -- GitLab