From 3029f97bbbc88b963c764c124ae9cf654b807ffb Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Thu, 8 Sep 2022 20:10:37 +0800 Subject: [PATCH] fix bug --- ppocr/losses/rec_aster_loss.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ppocr/losses/rec_aster_loss.py b/ppocr/losses/rec_aster_loss.py index 52605e46..9927fbc0 100644 --- a/ppocr/losses/rec_aster_loss.py +++ b/ppocr/losses/rec_aster_loss.py @@ -27,10 +27,9 @@ class CosineEmbeddingLoss(nn.Layer): self.epsilon = 1e-12 def forward(self, x1, x2, target): - similarity = paddle.sum( - x1 * x2, dim=-1) / (paddle.norm( - x1, axis=-1) * paddle.norm( - x2, axis=-1) + self.epsilon) + similarity = paddle.sum(x1 * x2, axis=-1) / (paddle.norm( + x1, axis=-1) * paddle.norm( + x2, axis=-1) + self.epsilon) one_list = paddle.full_like(target, fill_value=1) out = paddle.mean( paddle.where( -- GitLab