未验证 提交 cf9fc936 编写于 作者: littletomatodonkey's avatar littletomatodonkey 提交者: GitHub

fix label smooth bug (#1192)

上级 d2d89bec
...@@ -29,7 +29,7 @@ class CELoss(nn.Layer): ...@@ -29,7 +29,7 @@ class CELoss(nn.Layer):
self.epsilon = epsilon self.epsilon = epsilon
def _labelsmoothing(self, target, class_num): def _labelsmoothing(self, target, class_num):
if target.shape[-1] != class_num: if target.ndim == 1 or target.shape[-1] != class_num:
one_hot_target = F.one_hot(target, class_num) one_hot_target = F.one_hot(target, class_num)
else: else:
one_hot_target = target one_hot_target = target
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册