chainerrl icon indicating copy to clipboard operation
chainerrl copied to clipboard

[WIP] Use chainer.as_variable

Open muupan opened this issue 5 years ago • 3 comments

We no longer need to define our own function to wrap an array by a variable as chainer has as_variable since v4 (https://docs.chainer.org/en/v4.0.0/reference/generated/chainer.as_variable.html).

muupan avatar Jul 18 '19 09:07 muupan

Do the args require grads?

toslunar avatar Jul 18 '19 09:07 toslunar

Good point. It is difficult to guarantee that we won't compute gradient wrt mean or var of GaussianDistribution, so maybe we should not use chainer.as_variable here...

muupan avatar Jul 18 '19 09:07 muupan

Some facts

  • ~ACER computes gradient wrt Distribution.params via backward, not chainer.grad, so it can be affected by requires_grad=False.~ Now ACER users chainer.grad #511
  • Currently chainer.grad can compute gradient even when requires_grad=False, but this is a bug of Chainer and will be fixed (https://github.com/chainer/chainer/issues/5974)
  • chainer.distributions use chainer.as_variable for properties, so they may have the same problem.

muupan avatar Jul 18 '19 10:07 muupan