Rate this Page
★ ★ ★ ★ ★

TensorDictBase.lerp#

TensorDictBase.lerp_(end: TensorDictBase | Tensor, weight: TensorDictBase | Tensor | float)#

Interpolates linearly from every leaf to end in place and returns self.

The in-place version of lerp().

Parameters:
  • end (TensorDictBase or Tensor) – the end points. A tensordict is paired with the tensordict key by key and must have all its keys. A tensor is aligned with the batch dimensions of each leaf and expanded over its feature dimensions.

  • weight (TensorDictBase, Tensor or float) – the interpolation weight: a number for all the leaves, or a tensordict or a tensor paired like end. One of end and weight can be a tensordict and the other a tensor.

Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.