danijar / dreamerv3

Mastering Diverse Domains through World Models
https://danijar.com/dreamerv3
MIT License
1.36k stars 229 forks source link

(Maybe) a small bug in replay buffer implementation #101

Closed jsikyoon closed 11 months ago

jsikyoon commented 11 months ago

Shouldn't it be last = self.keys.pop(index)?

https://github.com/danijar/dreamerv3/blob/main/dreamerv3/embodied/replay/selectors.py#L42

danijar commented 11 months ago

Hi, that would be an obvious implementation but too expensive to pop from the middle of the array. Instead, we pop a different element from the end and then write it into the slot in the middle of the array that needs to be erased.