Hi @ptrblck,
Here is the shapes of inputs and val_h in my validation loops just before I passed them to my model:
INPUTS SHAPE: torch.Size([256, 20])
VAL_H SHAPE: 2, torch.Size([2, 256, 256]), torch.Size([2, 256, 256]) #len(val_h), val_h[0].shape, val_h[1].shape

If it helps, I also printed the Model Summary
SentimentRNN(
  (embedding): Embedding(19940, 40)
  (lstm): LSTM(40, 256, num_layers=2, batch_first=True, dropout=0.5)
  (dropout): Dropout(p=0.3)
  (fc): Linear(in_features=256, out_features=17, bias=True)
  (softmax): LogSoftmax()
)

Here is the full error logs from validation blocks (line 56):
RuntimeError                              Traceback (most recent call last)
<ipython-input-60-2da0ffaf5447> in <module>()
----> 1 train()

<ipython-input-59-f8c736390366> in train()
     54                     print("INPUTS SHAPE:", inputs.shape)
     55                     print("VAL_H SHAPE:", len(val_h), val_h[0].shape, val_h[1].shape)
---> 56                     output, val_h = net(inputs, val_h)
     57                     val_loss = criterion(output.squeeze(), labels)
     58 

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    487             result = self._slow_forward(*input, **kwargs)
    488         else:
--> 489             result = self.forward(*input, **kwargs)
    490         for hook in self._forward_hooks.values():
    491             hook_result = hook(self, input, result)

<ipython-input-31-f475a7e7b5f5> in forward(self, x, hidden)
     39         x = x.long()
     40         embeds = self.embedding(x)
---> 41         lstm_out, hidden = self.lstm(embeds, hidden)
     42 
     43         # stack up lstm outputs

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    487             result = self._slow_forward(*input, **kwargs)
    488         else:
--> 489             result = self.forward(*input, **kwargs)
    490         for hook in self._forward_hooks.values():
    491             hook_result = hook(self, input, result)

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/rnn.py in forward(self, input, hx)
    173                 hx = (hx, hx)
    174 
--> 175         self.check_forward_args(input, hx, batch_sizes)
    176         _impl = _rnn_impls[self.mode]
    177         if batch_sizes is None:

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/rnn.py in check_forward_args(self, input, hidden, batch_sizes)
    150         if self.mode == 'LSTM':
    151             check_hidden_size(hidden[0], expected_hidden_size,
--> 152                               'Expected hidden[0] size {}, got {}')
    153             check_hidden_size(hidden[1], expected_hidden_size,
    154                               'Expected hidden[1] size {}, got {}')

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/rnn.py in check_hidden_size(hx, expected_hidden_size, msg)
    146         def check_hidden_size(hx, expected_hidden_size, msg='Expected hidden size {}, got {}'):
    147             if tuple(hx.size()) != expected_hidden_size:
--> 148                 raise RuntimeError(msg.format(expected_hidden_size, tuple(hx.size())))
    149 
    150         if self.mode == 'LSTM':

RuntimeError: Expected hidden[0] size (2, 229, 256), got (2, 256, 256)

I’m not sure how my hidden_size become 229.
In addition to that, I have fix my softmax function. Thanks