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.
out i = start i + weight i × ( end i − start i ) \text{out}_i = \text{start}_i + \text{weight}_i \times (\text{end}_i - \text{start}_i) outi=starti+weighti×(endi−starti)
The shapes of start
and end
must be broadcastable. If weight
is a tensor, then the shapes of weight
, start
, and end
must be broadcastable.
>>> start = torch.arange(1., 5.) >>> end = torch.empty(4).fill_(10) >>> start tensor([ 1., 2., 3., 4.]) >>> end tensor([ 10., 10., 10., 10.]) >>> torch.lerp(start, end, 0.5) tensor([ 5.5000, 6.0000, 6.5000, 7.0000]) >>> torch.lerp(start, end, torch.full_like(start, 0.5)) tensor([ 5.5000, 6.0000, 6.5000, 7.0000])
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4