def lstmLayer(self, input):
    hidden = self.init_hidden(input.size(2))
    for i in range(input.size(0)):
        out, hidden = self.lstm1(input[i], hidden)
        hidden = self.repackage_hidden(hidden)
    return out

Here’s my code, but when I wrap my code with dataparallel, I get this message:
UserWarning: RNN module weights are not part of single contiguous chunk of memory. This means they need to be compacted at every call, possibly greately increasing memory usage. To compact weights again call flatten_parameters(). out, hidden = self.lstm1(input[i], hidden)
I am not sure where to call the flatten parameter, or is it something else I need to do?