hi @albanD, there are two networks here, both  GRU: encoder and decoder. It is the decoder that returns this error. Here’s the code for the encoder:
class EncoderGRU(nn.Module):

     # seq2seq model
     def __init__(self, vocab_size, embedding_size, hidden_size, device, num_layers=1):
         super(EncoderGRU, self).__init__()
         self.embedding = nn.Embedding(vocab_size, embedding_size)
         self.gru = nn.GRU(embedding_size, hidden_size, num_layers, batch_first=False)
         self.device = device

     def forward(self, input_dialogue, hidden=None):
         x = self.embedding(input_dialogue)
         x = x.view(x.size()[1], x.size()[0],-1)
         output, hidden = self.gru(x, hidden)
         return output, hidden

The error refers to the third line in the forward method, because [torch.cuda.FloatTensor [21, 3, 256]] refers to the hidden state (sequence length:21, batch size: 3, number of features: 256), not the embedding vector. Where do I modify hidden inplace?