class_docstr: Cutting 2d environment state to dictionary observation.
  
  :param max_pieces_in_inventory: Size of the inventory. If inventory gets full, the oldest pieces get discarded.
  :param raw_piece_size: Size of a fresh raw (= full-size) piece
class_docstr_tok: ["Cutting","2d","environment","state","to","dictionary","observation",".",":","param","max_pieces_in_inventory",":","Size","of","the","inventory",".","If","inventory","gets","full",",","the","oldest","pieces","get","discarded",".",":","param","raw_piece_size",":","Size","of","a","fresh","raw","(","=","full-size",")","piece"]
docstr: Converts core environment state to a machine readable agent observation.
docstr_tok: ["Converts","core","environment","state","to","a","machine","readable","agent","observation","."]
code: def maze_to_space(
      self, maze_state: Cutting2DMazeState
  ) -> Dict[str, np.ndarray]:
      """Converts core environment state to a machine readable agent observation."""
  
      # Convert inventory to numpy array and stretch it to full size (filling with zeros)
      inventory_state = maze_state.inventory
      inventory_state += [(0, 0)] * (
          self.max_pieces_in_inventory - len(maze_state.inventory)
      )
  
      # Compile dict space observation
      return {
          "inventory": np.asarray(inventory_state, dtype=np.float32),
          "inventory_size": np.asarray(
              [len(maze_state.inventory)], dtype=np.float32
          ),
          "ordered_piece": np.asarray(
              maze_state.current_demand, dtype=np.float32
          ),
      }
  
file_path: maze/tutorials/tutorial_maze_env/part03_maze_env/space_interfaces/dict_observation_conversion.py
imports: import numpy
  from typing import Dict
  from gym import spaces
  from maze.core.annotations import override
  from maze.core.env.observation_conversion import ObservationConversionInterface
  from ..env.maze_state import Cutting2DMazeState
label_desc: Use image node_id 2 for calling the ObservationConversion obj's underlying member method code with example usage: obj.maze_to_space(maze_state) and returns: dict