From f0dbf9b34dc39d95a483bbd6d0c16b56ac141e72 Mon Sep 17 00:00:00 2001 From: littletomatodonkey Date: Mon, 25 May 2020 15:15:23 +0000 Subject: [PATCH] fix one hot problem --- ppcls/modeling/loss.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ppcls/modeling/loss.py b/ppcls/modeling/loss.py index fde986b5..c19926e7 100644 --- a/ppcls/modeling/loss.py +++ b/ppcls/modeling/loss.py @@ -39,6 +39,8 @@ class Loss(object): one_hot_target = target soft_target = fluid.layers.label_smooth( label=one_hot_target, epsilon=self._epsilon, dtype="float32") + soft_target = fluid.layers.reshape( + soft_target, shape=[-1, self._class_dim]) return soft_target def _crossentropy(self, input, target): -- GitLab