diff --git a/ppcls/modeling/loss.py b/ppcls/modeling/loss.py index fde986b5d8ad22f4be3f5b3033adb537157d4324..c19926e76b01e4ba8d98e1d9931af48a8a33096a 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):