From c8094e6575c3327be63f415ca274805631850ff8 Mon Sep 17 00:00:00 2001 From: topduke <784990967@qq.com> Date: Thu, 19 Aug 2021 19:08:23 +0800 Subject: [PATCH] Update rec_nrtr_optim_head.py --- ppocr/modeling/heads/rec_nrtr_optim_head.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ppocr/modeling/heads/rec_nrtr_optim_head.py b/ppocr/modeling/heads/rec_nrtr_optim_head.py index 98f212d0..63473c11 100644 --- a/ppocr/modeling/heads/rec_nrtr_optim_head.py +++ b/ppocr/modeling/heads/rec_nrtr_optim_head.py @@ -216,7 +216,7 @@ class TransformerOptim(nn.Layer): new_shape = (n_curr_active_inst * n_bm, *d_hs) beamed_tensor = beamed_tensor.reshape( - [n_prev_active_inst, -1]) #contiguous() + [n_prev_active_inst, -1]) beamed_tensor = beamed_tensor.index_select( paddle.to_tensor(curr_active_inst_idx), axis=0) beamed_tensor = beamed_tensor.reshape([*new_shape]) @@ -337,7 +337,7 @@ class TransformerOptim(nn.Layer): n_inst, len_s, d_h = src_enc.shape src_enc = paddle.concat([src_enc for i in range(n_bm)], axis=1) src_enc = src_enc.reshape([n_inst * n_bm, len_s, d_h]).transpose( - [1, 0, 2]) #repeat(1, n_bm, 1) + [1, 0, 2]) #-- Prepare beams inst_dec_beams = [Beam(n_bm) for _ in range(n_inst)] -- GitLab