Skip to content

schola.sb3.utils.VecMergeDictActionWrapper

Class Definition

class schola.sb3.utils.VecMergeDictActionWrapper(venv)

Bases: VecEnvWrapper

A vectorized wrapper for merging a dictionary of actions into 1 single action. All actions in the dictionary must be of compatible types.

Parameters

venv

Type: VecEnv
The vectorized environment being wrapped.

Attributes

unwrapped

Methods

__init__

__init__(venv)

Parameters:

close

close()

Clean up the environment’s resources.

env_is_wrapped

env_is_wrapped(wrapper_class, indices=None)

Check if environments are wrapped with a given wrapper.

env_method

env_method(method_name, *method_args, indices=None, **method_kwargs)

Call instance methods of vectorized environments.

get_attr

get_attr(attr_name, indices=None)

Return attribute from vectorized environment.

get_images

get_images()

Return RGB images from each environment when available.

getattr_depth_check

getattr_depth_check(name, already_found)

See base class.

getattr_recursive

getattr_recursive(name)

Recursively check wrappers to find attribute.

render

render(mode="human")

Gym environment rendering.

reset

reset()

Reset all the environments and return an array of observations, or a tuple 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.

Returns: observation

Return type: ndarray | Dict[str, ndarray] | Tuple[ndarray, ...]

seed

seed(seed=None)

Sets the random seeds for all environments, based on a given seed.

set_attr

set_attr(attr_name, value, indices=None)

Set attribute inside vectorized environments.

step

step(action)

Step the environments with the given action.

Parameters:

  • action (ndarray) – The action

Returns: observation, reward, done, information

Return type: Tuple[ndarray | Dict[str, ndarray] | Tuple[ndarray, ...], ndarray, ndarray, List[Dict]]

step_async

step_async(actions)

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.

Parameters:

  • actions (ndarray)

Return type: None

step_wait

step_wait()

Wait for the step taken with step_async().

Returns: observation, reward, done, information

Return type: Tuple[ndarray | Dict[str, ndarray] | Tuple[ndarray, ...], ndarray, ndarray, List[Dict]]