Hi,
I am very new to pytorch and was following the sequence2seqeuce modelling with Attention tutorial.  The tutorial link is :
https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html 26
I am trying to implement the same model using LSTM layers in the encoder and decoder. The following code is the encoder class:
 class Encode(nn.Module):
    def __init__(self, input_size, hidden_size):
        super(Encode, self).__init__()
        self.hidden_size = config.hidden_size

        self.embedding = nn.Embedding(input_size, hidden_size)
        self.LSTM = nn.LSTM(hidden_size, hidden_size)

    def forward(self, input, hidden):
        embedded = self.embedding(input).view(1, 1, -1)
        output = embedded
        output, hidden = self.LSTM(output, hidden)
        return output, hidden

    def initHidden(self):
        return torch.zeros(1, 1, self.hidden_size, device=config.device)

The code shows following error:
RuntimeError: Expected hidden[0] size (1, 1, 256), got (1, 256)
I guess the LSTM layer has 3d tensor whereas GRU layer works with 2D tensors. Now how can i convert the 2d tensors into 3d?