facebookresearch / rlmeta

RLMeta is a light-weight flexible framework for Distributed Reinforcement Learning Research.
MIT License
284 stars 28 forks source link

Add at/get/front/back APIs for CircularBuffer #92

Closed xiaomengy closed 2 years ago

xiaomengy commented 2 years ago

This PR changed the behavior of APIs in CircularBuffer.

  1. Change at method to select keys and values based on indices in the CircularBuffer.
  2. Add get method to select values based on the keys.
  3. Add front() method to get the 1st key and value in the CircularBuffer, which is equivalent to buffer.at(0)
  4. Add back() method to get the last key and value in the CircularBuffer, which is equivalent toe buffer.at(-1)