code: def observation_spaces_to_in_shapes(
      observation_spaces: Dict[Union[int, str], gym.spaces.Dict]
  ) -> Dict[Union[int, str], Dict[str, Sequence[int]]]:
      """Convert an observation space to the input shapes for the neural networks
  
      :param observation_spaces: the observation spaces of a structured Env
      :return: the same structure but all the gym spaces are converted to tuples
      """
      in_shapes = dict()
      for obs_key, obs_dict in observation_spaces.items():
          in_shapes[obs_key] = dict()
          assert isinstance(obs_dict, gym.spaces.Dict)
          for key, value in obs_dict.spaces.items():
              assert isinstance(value, gym.spaces.Box), (
                  "Only box observation spaces supported at this point, but got: "
                  f"{type(value)}"
              )
              in_shapes[obs_key][key] = value.shape
  
      return in_shapes
  
file_path: maze/maze/perception/perception_utils.py
imports: import collections
  from collections import defaultdict
  from typing import Union, Dict, Any, Callable, Sequence, Iterable
  import gym
  import numpy
  import torch
  from gym import spaces
  from maze.core.env.structured_env import StepKeyType
  from maze.core.utils.structured_env_utils import flat_structured_space
label_desc: Use image node_id 1 for calling a global function with example usage: observation_spaces_to_in_shapes(observation_spaces) and returns: in_shapes