Skip to content

Commit 34092ab

Browse files
authored
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
1 parent 03babe1 commit 34092ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/paddle/nn/functional/loss.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,8 @@ def cross_entropy(input,
12751275
fluid.data_feeder.check_variable_and_dtype(
12761276
input, 'input', ['float32', 'float64'], 'softmax_cross_entropy')
12771277
fluid.data_feeder.check_variable_and_dtype(
1278-
label, 'label', ['int32', 'int64'], 'softmax_cross_entropy')
1278+
label, 'label', ['int32', 'int64', 'float32', 'float64'],
1279+
'softmax_cross_entropy')
12791280
out = softmax_with_cross_entropy(
12801281
input,
12811282
label,

0 commit comments

Comments
 (0)