Skip to content

Commit

Permalink
Update rec_nrtr_loss.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Topdu authored Oct 27, 2021
1 parent da02c71 commit 81f0a83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ppocr/losses/rec_nrtr_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def forward(self, pred, batch):
log_prb = F.log_softmax(pred, axis=1)
non_pad_mask = paddle.not_equal(
tgt, paddle.zeros(
tgt.shape, dtype='int32'))
tgt.shape, dtype=tgt.dtype))
loss = -(one_hot * log_prb).sum(axis=1)
loss = loss.masked_select(non_pad_mask).mean()
else:
Expand Down

0 comments on commit 81f0a83

Please sign in to comment.