def __init__(self, input_size, output_size, hidden_size):
        super(Encoder_Decoder, self).__init__()
        self.embed_input = nn.Embedding(input_size, hidden_size, padding_idx=-1)
        self.embed_target = nn.Embedding(output_size, hidden_size, padding_idx=-1)

I fixed
padding_idx=-1 >  padding_idx= 0

and used 0 for padding.