Solved by ptrblck in post #2 
              
              
                The linear layer is raising this error, as the number of input features from the activation doesn’t match the in_features from the layer. 
Check the shape of lstm_out and make sure it’s [batch_size, *, in_features]. 
PS: I would also be careful with using torch.squeeze without specifying the dim arg…