Skip to content

lit_sb3.vec_env.dummy_vec_env

source module lit_sb3.vec_env.dummy_vec_env

Classes

  • DummyVecEnv — Creates a simple vectorized wrapper for multiple environments, calling each environment in sequence on the.

source class DummyVecEnv(env_fns: list[Callable[[], gym.Env]])

Bases : VecEnv

Creates a simple vectorized wrapper for multiple environments, calling each environment in sequence on the.

current.

Python process. This is useful for computationally simple environment such as Cartpole-v1, as the overhead of multiprocess or multithread outweighs the environment computation time. This can also be used for RL methods that require a vectorized environment, but that you want a single environments to train with.

Parameters

  • env_fns : list[Callable[[], gym.Env]] — a list of functions that return environments to vectorize

Raises

  • ValueError — If the same environment instance is passed as the output of two or more different env_fn.

Methods

source method DummyVecEnv.step_async(actions: np.ndarray) → None

source method DummyVecEnv.step_wait() → VecEnvStepReturn

source method DummyVecEnv.reset() → VecEnvObs

source method DummyVecEnv.close() → None

source method DummyVecEnv.get_images() → Sequence[np.ndarray | None]

source method DummyVecEnv.render(mode: str | None = None) → np.ndarray | None

Gym environment rendering. If there are multiple environments then.

they are tiled together in one image via BaseVecEnv.render().

Parameters

  • mode : str | None — The rendering type.

source method DummyVecEnv.get_attr(attr_name: str, indices: VecEnvIndices = None) → list[Any]

Return attribute from vectorized environment (see base class).

source method DummyVecEnv.set_attr(attr_name: str, value: Any, indices: VecEnvIndices = None) → None

Set attribute inside vectorized environments (see base class).

source method DummyVecEnv.env_method(method_name: str, *method_args, indices: VecEnvIndices = None, **method_kwargs) → list[Any]

Call instance methods of vectorized environments.

source method DummyVecEnv.env_is_wrapped(wrapper_class: type[gym.Wrapper], indices: VecEnvIndices = None) → list[bool]

Check if worker environments are wrapped with a given wrapper.