ObservationStackWrapper

class maze.core.wrappers.observation_stack_wrapper.ObservationStackWrapper(env: StructuredEnvSpacesMixin, stack_config: List[Dict[str, Any]], stack_mode: str)

An wrapper stacking the observations of multiple subsequent time steps.

Provides functionality for:

  • selecting which observations to stack

  • how many past observations should be stacked

  • stacking deltas with the current step observation (instead of the observations itself)

Parameters:
  • env – Environment/wrapper to wrap.

  • stack_config

    The observation stacking configuration.

    observation: The name (key) of the respective observation keep_original: Bool, indicates weather to keep or remove the original observation from the dictionary. tag: Optional[str], tag to add to observation (e.g. stacked) delta: Bool, if true deltas are stacked to the previous observation stack_steps: Int, number of past steps to be stacked

  • stack_mode – Specifies how to stack observations. ‘group_by_actor_id’: Stacks previous observations by actor ID ‘flatten_history’: Stacks the most recent previous observations from flattened history

clone_from(env: ObservationStackWrapper) None

(overrides SimulatedEnvMixin)

implementation of SimulatedEnvMixin.

get_observation_and_action_dicts(maze_state: Any | None, maze_action: Any | None, first_step_in_episode: bool) tuple[Dict[int | str, Any] | None, Dict[int | str, Any] | None]

(overrides Wrapper)

If this is the first step in an episode, reset the observation stack.

get_observation_stack() Dict[str, List[numpy.ndarray]] | Dict[ActorID, Dict[str, List[numpy.ndarray]]]

Retrieve the observation stack of the wrapper.

Returns:

The current observation stack of th wrapper.

observation(observation: Dict[str, numpy.ndarray]) Dict[str, numpy.ndarray]

(overrides ObservationWrapper)

Stack observations.

param observation:

The observation to be stacked.

return:

The sacked observation.

reset() Dict[str, numpy.ndarray]

(overrides ObservationWrapper)

Intercept ObservationWrapper.reset and map observation.

set_observation_stack(observation_stack: Dict[str, List[numpy.ndarray]] | Dict[ActorID, Dict[str, List[numpy.ndarray]]]) None

Set the observation stack of the wrapper.

Parameters:

observation_stack – The observation stack to be set.