title: Understanding the output of LSTM predictions
body: <ul>
  <li><p>It's a 15-class classification model, <code>OUTPUT_DIM = 15</code>. I'm trying to input a frequency vector like this one <code>'hi my name is' =&gt; [1,43,2,56]</code>.</p>
  </li>
  <li><p>When I call <code>predictions = model(x_train[0])</code> I get an array of size <code>torch.Size([100, 15])</code>, instead of just a 1D array with 15 classes like this: <code>torch.Size([15])</code>. What's happening? Why is this the output? How can I fix it? Thank you in advance, more info below.</p>
  </li>
  </ul>
  <p>The model <a href="https://pytorch.org/tutorials/beginner/nlp/sequence_models_tutorial.html" rel="nofollow noreferrer">(from main docs)</a> is the following:</p>
  <pre><code>import torch.nn as nn
  
  class RNN(nn.Module):
      def __init__(self, vocab_size, embedding_dim, hidden_dim, output_dim):
          
          super().__init__()
          
          self.word_embeddings = nn.Embedding(vocab_size, embedding_dim)
          self.lstm = nn.LSTM(embedding_dim, hidden_dim)
          self.hidden2tag = nn.Linear(hidden_dim, output_dim)
          
      def forward(self, text):
                  
          embeds = self.word_embeddings(text)
          lstm_out, _ = self.lstm(embeds.view(len(text), 1, -1))
          tag_space = self.hidden2tag(lstm_out.view(len(text), -1))
          tag_scores = F.log_softmax(tag_space, dim=1)   
  
          return tag_scores
  </code></pre>
  <p>Parameters:</p>
  <pre><code>INPUT_DIM = 62288
  EMBEDDING_DIM = 64
  HIDDEN_DIM = 128
  OUTPUT_DIM = 15
  </code></pre>