Skip to content

Commit

Permalink
support label with float input of cross_entropy, test=develop (Paddle…
Browse files Browse the repository at this point in the history
…Paddle#30929)

* support label with float input of cross_entropy, test=develop

* fix code style in nn/functional/loss.py, test=develop
  • Loading branch information
chajchaj committed Feb 9, 2021
1 parent 52edaec commit f5ca2db
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/paddle/nn/functional/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f5ca2db

Please sign in to comment.