See Variable grad is always None when extending autograd
.cuda() creates another Variable that isn’t a leaf node in the computation graph. Since you’re using it as an input it doesn’t accumulate gradients.