I was having trouble getting PrioritizedReplayBuffer work with some of my code. In particular, the _sample_proportional method was always returning an array of zeros. I noticed that the _add function depends on the super class's self.pos:
Therefore, idx was always zero when adding to the segment tree, and the sample method always returned an array of zeros. Moving the last line out of the else block fixed the problem.
Am I missing any reason that this shouldn't be done?
Thank you for doing so much for the RL community, by the way! I am enjoying your book.
I was having trouble getting
PrioritizedReplayBuffer
work with some of my code. In particular, the_sample_proportional
method was always returning an array of zeros. I noticed that the_add
function depends on the super class'sself.pos
:However, the super class only tracks
pos
once the buffer is full:Therefore,
idx
was always zero when adding to the segment tree, and the sample method always returned an array of zeros. Moving the last line out of theelse
block fixed the problem.Am I missing any reason that this shouldn't be done?
Thank you for doing so much for the RL community, by the way! I am enjoying your book.