From 0478060d2756fff640221d55c1a0ab542e424a8a Mon Sep 17 00:00:00 2001 From: Thamme Gowda Date: Fri, 21 Aug 2020 19:54:05 +0000 Subject: [PATCH] fix contiguous issue with dec_bos_cut --- rtg/module/decoder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtg/module/decoder.py b/rtg/module/decoder.py index e4d0e23..709ccfd 100644 --- a/rtg/module/decoder.py +++ b/rtg/module/decoder.py @@ -346,7 +346,7 @@ def beam_decode(self, x_seqs, x_lens, max_len, beam_size=default_beam_size, num_ if actives.sum() == 0: # all sequences Ended break # [Batch x Beams x Vocab] <-- [Batch x Beams x Time] - flat_ys = ys.view(batch_size * beam_size, -1) + flat_ys = ys.contiguous().view(batch_size * beam_size, -1) log_prob = gen.generate_next(flat_ys) # ys upto current time step log_prob = log_prob.view(batch_size, beam_size, -1)