Hi Duane!
In most cases you can side step this issue by using nn.LSTM instead of nn.LSTMCell
docs: http://pytorch.org/docs/0.3.1/nn.html#lstm 377
nn.LSTM take your full sequence (rather than chunks), automatically initializes the hidden and cell states to zeros, runs the lstm over your full sequence (updating state along the way) and returns a final list of outputs and final hidden/cell state.
If you do need to initialize a hidden state because you’re decoding one item at a time or some similar situation,
I usually make a method like this:
def init_hidden(self, batch_size):
    hidden = Variable(next(self.parameters()).data.new(self.num_layers, batch_size, self.hidden_size))
    cell =  Variable(next(self.parameters()).data.new(self.num_layers, batch_size, self.hidden_size))
    return (hidden, cell)

next(self.parameters()).data.new() looks arcane but all it’s doing is grabbing the first parameter in the model and making a new tensor of the same type with specified dimensions. This way, if you call .cuda() on the model it’l return cuda tensors instead.