Hi Codeflux!



 codeflux:

loss = -distribution.log_prob(sample)*advantage.detach()
loss.requires_grad = True
loss.backwards()



advantage.detach() “breaks the computation graph,” and
loss.requires_grad = True doesn’t repair the damage.
Regardless of whether your code can be tweaked to (appear to)
work, loss must be usefully differentiable with respect to the
parameters you are trying to train in order for backpropagation
and training to work.
Best.
K. Frank