Rate this Page

RewardClipping#

class torchrl.envs.transforms.RewardClipping(clamp_min: float | None = None, clamp_max: float | None = None, in_keys: Sequence[NestedKey] | None = None, out_keys: Sequence[NestedKey] | None = None)[source]#

Clips the reward between clamp_min and clamp_max.

Parameters:
  • clip_min (scalar) – minimum value of the resulting reward.

  • clip_max (scalar) – maximum value of the resulting reward.

transform_reward_spec(reward_spec: TensorSpec) TensorSpec[source]#

Transforms the reward spec such that the resulting spec matches transform mapping.

Parameters:

reward_spec (TensorSpec) – spec before the transform

Returns:

expected spec after the transform