Thanks: I understand the ones are the gradients dloss/dloss=1 that are put at the very end of the backpropagation graph.
But creating this grad_seq this way fails with
AttributeError: ‘Variable’ object has no attribute ‘new’
EDIT: OK, it looks like it automatically converts tensors to variables, so this seems to work:
grad_seq = [loss_seq[0].data.new(1).fill_(1) for _ in range(len(loss_seq))]