class torchrl.objectives.value.functional.td0_return_estimate(gamma: float, next_state_value: Tensor, reward: Tensor, done: Tensor)[source]

TD(0) discounted return estimate of a trajectory.

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

  • gamma (scalar) – exponential mean discount.

  • next_state_value (Tensor) – value function result with new_state input. must be a [Batch x TimeSteps x 1] or [Batch x TimeSteps] tensor

  • reward (Tensor) – reward of taking actions in the environment. must be a [Batch x TimeSteps x 1] or [Batch x TimeSteps] tensor

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

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


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources