Does a linear interpolation of two tensors start and end based on a scalar weight and returns the resulting out tensor.

tch_lerp(start, end, weight)

Arguments

start

the tensor with the starting points.

end

the tensor with the ending points.

weight

the weight for the interpolation formula.

Details

out = start - weight * (end - start)

Examples

start <- tch_arange(1, 5) end <- tch_empty(4)$fill_(10) tch_lerp(start, end, 0.5)
#> tensor #> 5.5000 #> 6.0000 #> 6.5000 #> 7.0000 #> [ Variable[CPUFloatType]{4} ]