TensorDictBase.lerp#
- TensorDictBase.lerp(end: TensorCollection | Tensor, weight: TensorCollection | Tensor | float) Self#
Does a linear interpolation of two tensors
start(given byself) andendbased on a scalar or tensorweight.\[\text{out}_i = \text{start}_i + \text{weight}_i \times (\text{end}_i - \text{start}_i)\]The shapes of
startandendmust be broadcastable. Ifweightis a tensor, then the shapes ofweight,start, andendmust be broadcastable.- Parameters:
end (TensorDict) – the tensordict with the ending points.
weight (TensorDict, tensor or float) – the weight for the interpolation formula.
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.