I’d like to ask a simple question regarding a training based on policy gradient and experience replay.
When I am collecting experiences by interacting with an environment with a policy approximated with neural networks, should I turn off history tracking with no_grad or should I leave it and let it be tracked?
I think we need to track only when we replay the buffer containing experience trajectories but I am not so sure.
I’ve looked up a few code snippets and all of them didn’t turn off history tracking when they collect experience trajectories to store in the replay buffer. Then all the accumulated operations will be back propagated along with arbitrary many sampled trajectories to play out as many times as we wish. To me only sampled trajectories are to be used for training but not the ones used to collect for replay.
Hope you got to what I asking with my description. I am new to PyTorch and feel free to correct me if get anything wrong.