Thank you, guys. There’s still; something I am not too clear of. When I am defining a model in torch, usually, I can use nn.Sequential to place my layers in a container form such as
        neunet = nn.Sequential()
       local rnn        
        rnn = nn.FastLSTM(9, 9, 5)
        neunet:add(rnn) 
        rnn = nn.FastLSTM(9, 6, 5)
        neunet:add(rnn) 
        rnn = nn.FastLSTM(6, 3, 5)
        neunet:add(rnn) 
        neunet:add(nn.Dropout(0.3))
        neunet:add(nn.Linear(3, 3, bias))      
       neunet = nn.Sequencer(neunet, 3)

Now in PyTorch, I defined the same model (thanks to James’ pointing out to me that nn.LSTM is different from nn.LSTMCell):
class LSTMModel(nn.Module):
    def __init__(self, noutputs=3,numLayers=3):
        super(LSTMModel, self).__init__()
        
        self.nHidden = [9, 6, 6]
        self.cost = nn.MSELoss(size_average=False)
        self.noutputs = noutputs
        self.num_layers =  numLayers
        
        self.lstm0     = nn.LSTM(self.nHidden[0], self.nHidden[0], self.num_layers, 
                                batch_first= True, dropout=0.3)
        self.lstm1     = nn.LSTM(self.nHidden[1], self.nHidden[1], self.num_layers, 
                                batch_first= True, dropout=0.3)
        self.lstm2     = nn.LSTM(self.nHidden[2], self.nHidden[2], self.num_layers, 
                                batch_first= True, dropout=0.3)
        self.fc = nn.Linear(self.nHidden[2], noutputs)

    def forward(self, x):

        h0 = Variable(torch.zeros(self.num_layers, x.size(0), self.nHidden[0])) 
        c0 = Variable(torch.zeros(self.num_layers, x.size(0), self.nHidden[0]))
        
        #Now propagate the rnn 
        #rnn layer 1
        out0, _ = self.lstm0(x, (h0, c0))  
        
        #second rnn layer
        h1 = Variable(torch.zeros(self.num_layers, x.size(0), self.nHidden[1])) 
        c1 = Variable(torch.zeros(self.num_layers, x.size(0), self.nHidden[1]))
        out1, _ = self.lstm1(out0, (h1, c1)) 
        
        #third rnn layer
        h2 = Variable(torch.zeros(self.num_layers, x.size(0), self.nHidden[2])) 
        c2 = Variable(torch.zeros(self.num_layers, x.size(0), self.nHidden[2]))
        out2, _ = self.lstm2(out1, (h2, c2)) 
        
        #hidden layer of last time step
        out = self.fc(out2[:, -1, :])        
        return out

So I forward a DoubleTensor defined as
x = Variable(torch.randn(50000, 9), requires_grad=False) through this model and I get weird errors like
RuntimeError: matrices expected, got 1D, 2D tensors at /home/robotec/Documents/NNs/locuclab-pytorch/torch/lib/TH/generic/THTensorMath.c:1224