Shortcuts

td0_advantage_estimate

class torchrl.objectives.value.functional.td0_advantage_estimate(gamma: float, state_value: torch.Tensor, next_state_value: torch.Tensor, reward: torch.Tensor, done: torch.Tensor, terminated: torch.Tensor | None = None)[source]

TD(0) advantage estimate of a trajectory.

Also known as bootstrapped Temporal Difference or one-step return.

Parameters:
  • gamma (scalar) – exponential mean discount.

  • state_value (Tensor) – value function result with old_state input.

  • next_state_value (Tensor) – value function result with new_state input.

  • reward (Tensor) – reward of taking actions in the environment.

  • done (Tensor) – boolean flag for end of trajectory.

  • terminated (Tensor) – boolean flag for the end of episode. Defaults to done if not provided.

All tensors (values, reward and done) must have shape [*Batch x TimeSteps x *F], with *F feature dimensions.

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