Table of Contents

Class ClipAction<TObs, TAct>

Namespace
Gym.Wrappers
Assembly
Gym.dll

Clips every action into the env's Box bounds before the env sees it, as Gymnasium's ClipAction does; the wrapper's own action space is unbounded (Box(-inf, inf) of the same shape and dtype), since any action is accepted.

public class ClipAction<TObs, TAct> : TransformAction<TObs, NDArray, TAct>, IDynamicAttributes, IWrapper, IEnv, IDisposable, IRecordConstructorArgs

Type Parameters

TObs

The observation type, passed through.

TAct

The env's action type: arrays (NDArray, or object holding them).

Inheritance
Env<TObs, NDArray>
Wrapper<TObs, NDArray, TObs, TAct>
ActionWrapper<TObs, NDArray, TAct>
ClipAction<TObs, TAct>
Implements
Inherited Members
Extension Methods

Remarks

The clip is NumPy's np.clip(action, low, high) with the env's bounds, so its dtype follows NumPy's promotion of the action with the bounds. Each step's action is a new array.

Reference: gymnasium/wrappers/transform_action.py.

Constructors

ClipAction(Env<TObs, TAct>)

Wraps env.

public ClipAction(Env<TObs, TAct> env)

Parameters

env Env<TObs, TAct>

The env; its action space must be a Box.

Exceptions

TypeError

Thrown when the action space is no Box (Gymnasium's message), or env is null.

ClipAction(Env<TObs, TAct>, ClipActionOptions)

Builds the instance from its options record: the properties set, the constructor's defaults for the rest.

public ClipAction(Env<TObs, TAct> env, ClipActionOptions options)

Parameters

env Env<TObs, TAct>

The env to wrap.

options ClipActionOptions

The options.

Exceptions

ArgumentNullException

Thrown when options is null.