Skip to content

Commit

Permalink
Update loss.py --refactored fluid_softmax_with_cross_entropy (#56686)
Browse files Browse the repository at this point in the history
* Update loss.py --refactored fluid_softmax_with_cross_entropy

* Update loss.py
  • Loading branch information
zeus2x7 authored Aug 28, 2023
1 parent dcaca0f commit 3568a99
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/paddle/nn/functional/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,13 @@ def fluid_softmax_with_cross_entropy(
"""
input_dims = len(list(logits.shape))
if input_dims == 0:
raise ValueError('The dimention of input should be larger than zero!')
raise ValueError('The dimension of input should be larger than zero!')

label_dims = len(list(label.shape))
if input_dims - 1 != label_dims and input_dims != label_dims:
raise ValueError(
'Expected nput_dims - 1 = label_dims or input_dims == label_dims\
(got nput_dims{}, label_dims{})'.format(
'Expected input_dims - 1 = label_dims or input_dims == label_dims\
(got input_dims{}, label_dims{})'.format(
input_dims, label_dims
)
)
Expand Down

0 comments on commit 3568a99

Please sign in to comment.