未验证 提交 3568a99c 编写于 作者: A Aditya Raj 提交者: GitHub

Update loss.py --refactored fluid_softmax_with_cross_entropy (#56686)

* Update loss.py --refactored fluid_softmax_with_cross_entropy

* Update loss.py
上级 dcaca0f4
...@@ -256,13 +256,13 @@ def fluid_softmax_with_cross_entropy( ...@@ -256,13 +256,13 @@ def fluid_softmax_with_cross_entropy(
""" """
input_dims = len(list(logits.shape)) input_dims = len(list(logits.shape))
if input_dims == 0: 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)) label_dims = len(list(label.shape))
if input_dims - 1 != label_dims and input_dims != label_dims: if input_dims - 1 != label_dims and input_dims != label_dims:
raise ValueError( raise ValueError(
'Expected nput_dims - 1 = label_dims or input_dims == label_dims\ 'Expected input_dims - 1 = label_dims or input_dims == label_dims\
(got nput_dims{}, label_dims{})'.format( (got input_dims{}, label_dims{})'.format(
input_dims, label_dims input_dims, label_dims
) )
) )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册