I also met this problem when I am trying to stack a few single-layer rnn to constitute a multi-layer one. My code is just like this:
self.rnns = [nn.LSTM(input_size=input_size if l == 0 else 2 * cell_size,
             hidden_size=cell_size, num_layers=1, batch_first=True,
             bidirectional=True) for l in range(num_layers)]

And I solved the problem by adding following line:
self.rnns = torch.nn.ModuleList(self.rnns)