提交 ab3735a4 编写于 作者: littletomatodonkey's avatar littletomatodonkey

fix loss

上级 922f33fe
......@@ -47,8 +47,7 @@ class Loss(object):
if self._label_smoothing:
target = self._labelsmoothing(target)
input = -F.log_softmax(input, axis=-1)
log_probs = -F.log_softmax(input, axis=-1)
cost = paddle.reduce_sum(target * log_probs, dim=-1)
cost = paddle.reduce_sum(target * input, dim=-1)
else:
# softmax_out = F.softmax(input)
cost = F.cross_entropy(input=input, label=target)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册