class_docstr: Context manager for temporarily switching directories (e.g., for loading policies or envs from output
  directories).
  
  Can be used also in the middle of a Hydra run, when Hydra already changed the current working directory,
  but the input_path is expected to be relative to the original one.
  
  More info:
  
  Hydra is configured to create a fresh output directory for each run.
  However, to ensure model states, normalization stats and else are loaded from expected
  locations, we will change the dir back to the original working dir for the initialization
  (and then change it back so that all later script output lands in the hydra output dir as expected)
class_docstr_tok: ["Context","manager","for","temporarily","switching","directories","(","e.g.",",","for","loading","policies","or","envs","from","output","directories",")",".","Can","be","used","also","in","the","middle","of","a","Hydra","run",",","when","Hydra","already","changed","the","current","working","directory",",","but","the","input_path","is","expected","to","be","relative","to","the","original","one",".","More","info",":","Hydra","is","configured","to","create","a","fresh","output","directory","for","each","run",".","However",",","to","ensure","model","states",",","normalization","stats","and","else","are","loaded","from","expected","locations",",","we","will","change","the","dir","back","to","the","original","working","dir","for","the","initialization","(","and","then","change","it","back","so","that","all","later","script","output","lands","in","the","hydra","output","dir","as","expected",")"]
code: def __init__(self, input_dir: str):
      self.input_dir = input_dir
  
imports: import os
  from pathlib import Path
  from typing import Mapping, Union, Sequence
  import hydra
  import yaml
  from hydra import initialize_config_module, compose
  from hydra.core.hydra_config import HydraConfig
  from omegaconf import DictConfig
  from maze.core.agent.serialized_torch_policy import SerializedTorchPolicy
  from maze.core.env.maze_env import MazeEnv
  from maze.core.utils.factory import Factory, ConfigType, CollectionOfConfigType
  from maze.core.wrappers.wrapper_factory import WrapperFactory
label_desc: Use image node_id 1 to create a new SwitchWorkingDirectoryToInput object  with example: obj = SwitchWorkingDirectoryToInput(input_dir)