ReplayObservationCache
python
ReplayObservationCache() -> NoneCache of completed replay results keyed by (initial state, action indices).
Replays are deterministic from their snapshot, so entries never go stale and repeat replays can be answered from memory instead of the emulator. Only the fhw observation layout is supported (frames must be axis 0 of each stack). Keys hold the repository's state bytes by reference, so they add no state memory of their own.
Properties
byte_size
python
byte_size: intGet the approximate frame memory held by the cache.
Returns:
int– The total frame bytes.
entry_count
python
entry_count: intGet the number of cached replay slices.
Returns:
int– The entry count.
hits
python
hits: intGet the number of lookups answered from the cache.
Returns:
int– The hit count.
misses
python
misses: intGet the number of lookups that fell through to the emulator.
Returns:
int– The miss count.
Methods
get
python
get(initial_state: bytes, action_indices: bytes) -> CachedReplay | NoneLook up the cached replay for one slice.
Parameters:
initial_state(bytes) – The serialised emulator state the replay starts from.action_indices(bytes) – The action indices to replay.
Returns:
CachedReplay | None– The cached replay, orNoneif the slice has not been cached.
store
python
store(initial_state: bytes, action_indices: bytes, result: MultiEnvResult) -> NoneCache one completed replay result.
Parameters:
initial_state(bytes) – The serialised emulator state the replay started from.action_indices(bytes) – The action indices that were requested for replay.result(MultiEnvResult) – The completed replay result.