BaseModelBuilder

class maze.perception.builders.base.BaseModelBuilder(modality_config: Dict[str, Union[str, Dict[str, Any]]], observation_modality_mapping: Dict[str, str], shared_embedding_keys: Optional[Union[List[str], Dict[str, List[str]]]])

Base class for perception default model builders.

Parameters
  • modality_config – dictionary mapping perception modalities to blocks and block config parameters.

  • observation_modality_mapping – A mapping of observation keys to perception modalities.

  • shared_embedding_keys – The shared embedding keys to use as an input to the critic network where the value can be one of the following: - None, empty list or dict of empty lists: No shared embeddings are used. - A list of str values: The shared embedding keys to use for creating the critic network in each substep (the same keys). - A dict of lists: Here the keys have to refer to the step-keys of the environment, the corresponding lists specify the input keys to the critic network in this step.

abstract from_observation_space(observation_space: gym.spaces.Dict)maze.perception.blocks.inference.InferenceBlock

Compiles an inference graph for a given observation space.

Only observations which are contained in the self.observation_modalities dictionary are considered.

Parameters

observation_space – The respective observation space.

Returns

the resulting inference block.

init_shared_embedding_keys(step_keys: Iterable[Union[str, int]])None

Init the shared embedding keys as a dict using the step_keys of the environment.

Parameters

step_keys – the step keys of the environment steps

classmethod to_recurrent_gym_space(observation_space: gym.spaces.Dict, rnn_steps: int) → gym.spaces.Dict

Converts the given observation space to a recurrent space.

Parameters
  • observation_space – The respective observation space.

  • rnn_steps – Number of recurrent time steps.

Returns

The rnn modified dictionary observation space.