The dimension error is now solved but its showing

RuntimeError: Dimension out of range (expected to be in range of [-2, 1], but got 2)

And the line its throwing the error is
decoder_output, decoder_hidden, decoder_attention = decoder(
            decoder_input, decoder_hidden, encoder_outputs)

inside the train function