# tensorplay.functional.lerp Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.lerp.html ```python tensorplay.functional.lerp(input, end, weight, *, out=None) ``` Does a linear interpolation of two tensors start (given by input) and end based on a scalar or tensor weight and returns the resulting out tensor. $$\text{out}_i = \text{start}_i + \text{weight}_i \times (\text{end}_i - \text{start}_i)$$ The shapes of start and end must be [broadcastable](/docs/notes/broadcasting.html#broadcasting-semantics). If weight is a tensor, then the shapes of weight, start, and end must be [broadcastable](/docs/notes/broadcasting.html#broadcasting-semantics). Parameters: - input ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – the tensor with the starting points - end ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – the tensor with the ending points - weight ([float](https://docs.python.org/3/builtins/functions.html#float) or tensor) – the weight for the interpolation formula Keyword Arguments: out ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor), optional) – the output tensor. Example: ``` >>> start = tensorplay.arange(1., 5.) >>> end = tensorplay.empty(4).fill_(10) >>> start tensor([ 1., 2., 3., 4.]) >>> end tensor([ 10., 10., 10., 10.]) >>> tensorplay.lerp(start, end, 0.5) tensor([ 5.5000, 6.0000, 6.5000, 7.0000]) >>> tensorplay.lerp(start, end, tensorplay.full_like(start, 0.5)) tensor([ 5.5000, 6.0000, 6.5000, 7.0000]) ```