harl.envs package¶
Submodules¶
harl.envs.env_wrappers module¶
Modified from OpenAI Baselines code to work with multi-agent envs
- class harl.envs.env_wrappers.CloudpickleWrapper(x)[source]¶
Bases:
object
Uses cloudpickle to serialize contents (otherwise multiprocessing tries to use pickle)
Bases:
ShareVecEnv
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.
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.
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
Bases:
ShareVecEnv
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.
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.
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
Bases:
ABC
An abstract asynchronous, vectorized environment. Used to batch data from multiple copies of an environment, so that each observation becomes an batch of observations, and expected action is a batch of actions to be applied per-environment.
Clean up the extra resources, beyond what’s in this base class. Only runs when not self.closed.
Return RGB images from each environment
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 the environments synchronously.
This is available for backwards compatibility.
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.
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
- harl.envs.env_wrappers.tile_images(img_nhwc)[source]¶
- Tile N images into one big PxQ image
(P,Q) are chosen to be as close as possible, and if N is square, then P=Q.
- input: img_nhwc, list or array of images, ndim=4 once turned into array
n = batch index, h = height, w = width, c = channel
- Returns:
bigim_HWc, ndarray with ndim=3