Skip to content

ReplayObservationCache ​

python
ReplayObservationCache() -> None

Cache 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.

Source

Properties ​

byte_size ​

python
byte_size: int

Get the approximate frame memory held by the cache.

Returns:

  • int – The total frame bytes.

Source

entry_count ​

python
entry_count: int

Get the number of cached replay slices.

Returns:

  • int – The entry count.

Source

hits ​

python
hits: int

Get the number of lookups answered from the cache.

Returns:

  • int – The hit count.

Source

misses ​

python
misses: int

Get the number of lookups that fell through to the emulator.

Returns:

  • int – The miss count.

Source

Methods ​

get ​

python
get(initial_state: bytes, action_indices: bytes) -> CachedReplay | None

Look 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, or None if the slice has not been cached.

Source

store ​

python
store(initial_state: bytes, action_indices: bytes, result: MultiEnvResult) -> None

Cache 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.

Source