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

fix one hot problem

上级 6d9eb8ca
...@@ -39,6 +39,8 @@ class Loss(object): ...@@ -39,6 +39,8 @@ class Loss(object):
one_hot_target = target one_hot_target = target
soft_target = fluid.layers.label_smooth( soft_target = fluid.layers.label_smooth(
label=one_hot_target, epsilon=self._epsilon, dtype="float32") label=one_hot_target, epsilon=self._epsilon, dtype="float32")
soft_target = fluid.layers.reshape(
soft_target, shape=[-1, self._class_dim])
return soft_target return soft_target
def _crossentropy(self, input, target): def _crossentropy(self, input, target):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册