Table of Contents

Class VectorizeTransformAction<TObs, TWAct, TAct>

Namespace
Gym.Wrappers.Vector
Assembly
Gym.dll

Vectorizes a single-env action transform (Gymnasium's VectorizeTransformAction): the wrapper class is built over a stand-in env of the single action space, and its function is applied to each sub-env's action.

public class VectorizeTransformAction<TObs, TWAct, TAct> : VectorActionWrapper<TObs, TWAct, TAct>, IVectorEnv, IDisposable

Type Parameters

TObs

The batched observation type, passed through.

TWAct

The wrapper's batched action type.

TAct

The env's batched action type.

Inheritance
VectorEnv<TObs, TWAct>
VectorWrapper<TObs, TWAct, TObs, TAct>
VectorActionWrapper<TObs, TWAct, TAct>
VectorizeTransformAction<TObs, TWAct, TAct>
Implements
Derived
Inherited Members
Extension Methods

Remarks

When the wrapper's batched space equals the env's (same_out), the results are written into the caller's action batch in place, as in Gymnasium; otherwise into the wrapper's buffer, and a deep copy is passed on.

Reference: gymnasium/wrappers/vector/vectorize_action.py.

Constructors

VectorizeTransformAction(VectorEnv<TObs, TAct>, Type, object?)

Wraps env, building wrapper over its single action space.

public VectorizeTransformAction(VectorEnv<TObs, TAct> env, Type wrapper, object? kwargs = null)

Parameters

env VectorEnv<TObs, TAct>

The vector env.

wrapper Type

The single-env transform wrapper class (typeof(ClipAction<,>)).

kwargs object

The wrapper's other arguments by Python name, or null.

Exceptions

TypeError

Thrown when the class cannot be vectorized or built, or a space does not hold TWAct.

ValueError

Thrown for what the wrapper's constructor refuses.

Properties

SameOut

Whether the wrapper's batched space equals the env's (same_out).

public bool SameOut { get; }

Property Value

bool

Wrapper

The single-env wrapper whose function is applied (wrapper); owned.

public IEnv Wrapper { get; }

Property Value

IEnv

Methods

Actions(TWAct)

Each sub-env's action through the wrapper's function, stacked again.

public override TAct Actions(TWAct actions)

Parameters

actions TWAct

The wrapper's batched actions.

Returns

TAct

The caller's batch filled in place (SameOut), or a deep copy of the wrapper's buffer.

Dispose(bool)

Releases the buffer and the single-env wrapper, then disposes as every vector wrapper does.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true from Dispose().