未验证 提交 6589b2a8 编写于 作者: L littletomatodonkey 提交者: GitHub

Merge pull request #277 from littletomatodonkey/dyg/adp-2.0b

fix loss
...@@ -47,8 +47,7 @@ class Loss(object): ...@@ -47,8 +47,7 @@ class Loss(object):
if self._label_smoothing: if self._label_smoothing:
target = self._labelsmoothing(target) target = self._labelsmoothing(target)
input = -F.log_softmax(input, axis=-1) input = -F.log_softmax(input, axis=-1)
log_probs = -F.log_softmax(input, axis=-1) cost = paddle.reduce_sum(target * input, dim=-1)
cost = paddle.reduce_sum(target * log_probs, dim=-1)
else: else:
# softmax_out = F.softmax(input) # softmax_out = F.softmax(input)
cost = F.cross_entropy(input=input, label=target) 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.
先完成此消息的编辑!
想要评论请 注册