class_docstr: Structured environment version of the cutting 2D environment.
  The environment alternates between the two sub-steps:
  
  - Select cutting piece
  - Select cutting configuration (cutting order and cutting orientation)
  
  :param maze_env: The "flat" cutting 2D environment to wrap.
class_docstr_tok: ["Structured","environment","version","of","the","cutting","2D","environment",".","The","environment","alternates","between","the","two","sub-steps",":","-","Select","cutting","piece","-","Select","cutting","configuration","(","cutting","order","and","cutting","orientation",")",":","param","maze_env",":","The","``","flat","''","cutting","2D","environment","to","wrap","."]
docstr: Formats initial observation / observation available for the first sub-step.
docstr_tok: ["Formats","initial","observation","\/","observation","available","for","the","first","sub-step","."]
code: def _obs_selection_step(
      flat_obs: Dict[str, np.array]
  ) -> Dict[str, np.array]:
      """Formats initial observation / observation available for the first sub-step."""
      observation = deepcopy(flat_obs)
  
      # prepare inventory mask
      sorted_order = np.sort(observation["ordered_piece"].flatten())
      sorted_inventory = np.sort(observation["inventory"], axis=1)
  
      observation["inventory_mask"] = np.all(
          observation["inventory"] > 0, axis=1
      ).astype(np.float32)
      for i in np.nonzero(observation["inventory_mask"])[0]:
          # exclude pieces which do not fit
          observation["inventory_mask"][i] = np.all(
              sorted_order <= sorted_inventory[i]
          )
  
      return observation
  
file_path: maze/tutorials/tutorial_maze_env/part06_struct_env/env/struct_env_masked.py
imports: from copy import deepcopy
  from typing import Dict, List, Tuple
  import gym
  import numpy
  from tutorial_maze_env.part06_struct_env.env.maze_env import maze_env_factory
  from tutorial_maze_env.part06_struct_env.env.struct_env import StructuredCutting2DEnvironment
  from maze.core.env.maze_env import MazeEnv
label_desc: Use image node_id 2 for calling the MaskedStructuredCutting2DEnvironment obj's underlying member method code with example usage: obj._obs_selection_step(flat_obs) and returns: observation