Thanks for replying. I don’t believe it’s accumulating.
encoder_outputs = Variable(torch.zeros(max_length, encoder.hidden_size))
encoder_outputs = encoder_outputs.cuda() if use_cuda else encoder_outputs
for ei in range(input_length):
    encoder_output, encoder_hidden = encoder(input_variable[ei],
                                             encoder_hidden)
    encoder_outputs[ei] = encoder_outputs[ei] + encoder_output[0][0]