class_docstr: Base class for perception default model builders.
  
  :param modality_config: dictionary mapping perception modalities to blocks and block config parameters.
  :param observation_modality_mapping: A mapping of observation keys to perception modalities.
  :param 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.
class_docstr_tok: ["Base","class","for","perception","default","model","builders",".",":","param","modality_config",":","dictionary","mapping","perception","modalities","to","blocks","and","block","config","parameters",".",":","param","observation_modality_mapping",":","A","mapping","of","observation","keys","to","perception","modalities",".",":","param","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","."]
docstr: Converts the given observation space to a recurrent space.
  
  :param observation_space: The respective observation space.
  :param rnn_steps: Number of recurrent time steps.
  :return: The rnn modified dictionary observation space.
docstr_tok: ["Converts","the","given","observation","space","to","a","recurrent","space",".",":","param","observation_space",":","The","respective","observation","space",".",":","param","rnn_steps",":","Number","of","recurrent","time","steps",".",":","return",":","The","rnn","modified","dictionary","observation","space","."]
code: def to_recurrent_gym_space(
      cls, observation_space: spaces.Dict, rnn_steps: int
  ) -> spaces.Dict:
      """Converts the given observation space to a recurrent space.
  
      :param observation_space: The respective observation space.
      :param rnn_steps: Number of recurrent time steps.
      :return: The rnn modified dictionary observation space.
      """
      assert rnn_steps > 1
  
      rnn_dict = dict()
      for key, space in observation_space.spaces.items():
          assert isinstance(space, spaces.Box)
          rnn_low = np.repeat(
              space.low[np.newaxis], axis=0, repeats=rnn_steps
          )
          rnn_high = np.repeat(
              space.high[np.newaxis], axis=0, repeats=rnn_steps
          )
          rnn_dict[key] = spaces.Box(
              low=rnn_low, high=rnn_high, dtype=space.dtype
          )
  
      return spaces.Dict(rnn_dict)
  
file_path: maze/maze/perception/builders/base.py
imports: from abc import abstractmethod, ABC
  from typing import Dict, Union, Any, Optional, List, Iterable
  import numpy
  from gym import spaces
  from omegaconf import ListConfig, DictConfig
  from maze.core.env.structured_env import StepKeyType
  from maze.perception.blocks.inference import InferenceBlock
label_desc: Use image node_id 3 for calling the BaseModelBuilder obj's underlying member method code with example usage: obj.to_recurrent_gym_space(cls, observation_space, rnn_steps) and returns: spaces