title: LSTM's expected hidden state dimensions doesn't take batch size into account
body: <p>I have this decoder model, which is supposed to take batches of sentence embeddings (batchsize = 50, hidden size=300) as input and output a batch of one hot representation of predicted sentences:</p>
  
  <pre><code>class DecoderLSTMwithBatchSupport(nn.Module):
          # Your code goes here
          def __init__(self, embedding_size,batch_size, hidden_size, output_size):
              super(DecoderLSTMwithBatchSupport, self).__init__()
              self.hidden_size = hidden_size
              self.batch_size = batch_size
              self.lstm = nn.LSTM(input_size=embedding_size,num_layers=1, hidden_size=hidden_size, batch_first=True)
              self.out = nn.Linear(hidden_size, output_size)
              self.softmax = nn.LogSoftmax(dim=1)
  
          def forward(self, my_input, hidden):
              print(type(my_input), type(hidden))
              output, hidden = self.lstm(my_input, hidden)
              output = self.softmax(self.out(output[0]))
              return output, hidden
  
          def initHidden(self):
              return Variable(torch.zeros(1, self.batch_size, self.hidden_size)).cuda()
  </code></pre>
  
  <p>However, when I run it using:</p>
  
  <pre><code>decoder=DecoderLSTMwithBatchSupport(vocabularySize,batch_size, 300, vocabularySize)
  decoder.cuda()
  decoder_input=np.zeros([batch_size,vocabularySize])
      for i in range(batch_size):
          decoder_input[i] = embeddings[SOS_token]
      decoder_input=Variable(torch.from_numpy(decoder_input)).cuda()
      decoder_hidden = (decoder.initHidden(),decoder.initHidden())
          for di in range(target_length):
              decoder_output, decoder_hidden = decoder(decoder_input.view(1,batch_size,-1), decoder_hidden)
  </code></pre>
  
  <p>I get he following error:</p>
  
  <blockquote>
    <p>Expected hidden[0] size (1, 1, 300), got (1, 50, 300)</p>
  </blockquote>
  
  <p>What am I missing in order to make the model expect batched hidden states?</p>