Thank you for the workaround! It runs without error.
However I don’t understand what is “get gradients only from the last iteration of the loop”. What I desire is to propagate gradients into each output step, throughout all the sequence to the beginning.
Should I propagate into each output step indivisually? Like this:
for prob in probs:
    prob.backward(gradient, retain_variables = True)