Do you know why this block of code giving the error “One of the differentiated Tensors appears to not have been used in the graph”?
a = torch.rand(10, requires_grad=True)

output = (2 * a).sum()

torch.autograd.grad(output, a[0])