diff --git a/README.md b/README.md index c1b5db3e..bb62fc38 100644 --- a/README.md +++ b/README.md @@ -94,3 +94,6 @@ Check out models' performance, usage and source code here. readers & savers + + +*In memory of @FengZiYjun. May his soul rest in peace. We will miss you very very much!* \ No newline at end of file diff --git a/fastNLP/modules/encoder/variational_rnn.py b/fastNLP/modules/encoder/variational_rnn.py index 5a2e99f3..827b0abc 100644 --- a/fastNLP/modules/encoder/variational_rnn.py +++ b/fastNLP/modules/encoder/variational_rnn.py @@ -148,11 +148,10 @@ class VarRNNBase(nn.Module): seq_len = x.size(1) if self.batch_first else x.size(0) max_batch_size = x.size(0) if self.batch_first else x.size(1) seq_lens = torch.LongTensor([seq_len for _ in range(max_batch_size)]) - _tmp = pack_padded_sequence(x, seq_lens, batch_first=self.batch_first) - x, batch_sizes = _tmp.data, _tmp.batch_sizes + input = pack_padded_sequence(input, seq_lens, batch_first=self.batch_first) else: - max_batch_size = int(x.batch_sizes[0]) - x, batch_sizes = x.data, x.batch_sizes + max_batch_size = int(input.batch_sizes[0]) + input, batch_sizes = input.data, input.batch_sizes if hx is None: hx = x.new_zeros(self.num_layers * self.num_directions,