Shortcuts

RewardClipping

class torchrl.envs.transforms.RewardClipping(clamp_min: float = None, clamp_max: float = 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

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources