Open leix28 opened 4 years ago
I tried, there is a dimensionality missmatch with your line...
I also encountered a problem with inference of a 2-layer model. The fix for me was changing these lines in the inference() code in model.py:
if self.bidirectional or self.num_layers > 1:
# unflatten hidden state
hidden = hidden.view(self.hidden_factor, batch_size, self.hidden_size)
hidden = hidden.unsqueeze(0)
to
if self.bidirectional or self.num_layers > 1:
# unflatten hidden state
hidden = hidden.view(self.hidden_factor, batch_size, self.hidden_size)
if self.num_layers == 1:
hidden = hidden.unsqueeze(0)
I think line (3) should be
This snap of code appears in both forward and inference.