Utilities for Vector Env

class xuance.environment.vector_envs.env_utils.CloudpickleWrapper(x)[source]

Bases: object

Uses cloudpickle to serialize contents (otherwise multiprocessing tries to use pickle)

xuance.environment.vector_envs.env_utils.clear_mpi_env_vars()[source]

from mpi4py import MPI will call MPI_Init by default. If the child process has MPI environment variables, MPI will think that the child process is an MPI process just like the parent and do bad things such as hang. This context manager is a hacky way to clear those environment variables temporarily such as when we are starting multiprocessing Processes.

xuance.environment.vector_envs.env_utils.combine_actions(group_of_policy_out: list, n_envs: int)[source]
xuance.environment.vector_envs.env_utils.copy_obs_dict(obs)[source]
xuance.environment.vector_envs.env_utils.dict_to_obs(obs_dict)[source]
xuance.environment.vector_envs.env_utils.flatten_list(l)[source]
xuance.environment.vector_envs.env_utils.flatten_obs(obs)[source]
xuance.environment.vector_envs.env_utils.obs_n_space_info(obs_n_space)[source]
xuance.environment.vector_envs.env_utils.obs_space_info(obs_space)[source]
xuance.environment.vector_envs.env_utils.tile_images(images)[source]