code: def _flatten_obs(obs):
      assert isinstance(obs, (list, tuple))
      assert len(obs) > 0
  
      if isinstance(obs[0], dict):
          keys = obs[0].keys()
          return {k: np.stack([o[k] for o in obs]) for k in keys}
      else:
          return np.stack(obs)
  
file_path: baselines/baselines/common/vec_env/subproc_vec_env.py
imports: import multiprocessing
  import numpy
  from .vec_env import VecEnv, CloudpickleWrapper, clear_mpi_env_vars
label_desc: Use image node_id 2 for calling a global function with example usage: _flatten_obs(obs) and returns: unknown, np