torch.lerp
-
torch.lerp(input, end, weight, *, out=None) -
Выполняет линейную интерполяцию двух тензоров
start(заданныхinput) иendна основе скалярного или тензорного значенияweightи возвращает результирующийoutтензор.Формы
startиendдолжны быть совместимы для трансляции. Еслиweightявляется тензором, то формыweight,start, иendдолжны быть совместимы для трансляции.- Параметры:
- Ключевые аргументы:
-
out (Tensor, необязательно) – выходной тензор.
Пример:
>>> 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])
© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/1.13/generated/torch.lerp.html