Base Class for Vector Environments

exception xuance.environment.vector_envs.vector_env.AlreadySteppingError[source]

Bases: Exception

exception xuance.environment.vector_envs.vector_env.NotSteppingError[source]

Bases: Exception

class xuance.environment.vector_envs.vector_env.VecEnv(num_envs, observation_space, action_space)[source]

Bases: ABC

close()[source]
abstractmethod close_extras()[source]

Clean up the extra resources, beyond what’s in this base class. Only runs when not self.closed.

render(mode)[source]
abstractmethod reset()[source]

Reset all the environments and return an array of observations, or a dict of observation arrays. If step_async is still doing work, that work will be cancelled and step_wait() should not be called until step_async() is invoked again.

step(actions)[source]
abstractmethod step_async(actions)[source]

Tell all the environments to start taking a step with the given actions. Call step_wait() to get the results of the step. You should not call this if a step_async run is already pending.

abstractmethod step_wait()[source]

Wait for the step taken with step_async(). Returns (obs, rews, dones, infos):

  • obs: an array of observations, or a dict of

    arrays of observations.

  • rews: an array of rewards

  • dones: an array of “episode done” booleans

  • infos: a sequence of info objects