mindspore.ops.lerp
- mindspore.ops.lerp(input, end, weight)[source]
Does a linear interpolation of two tensors input and end based on a float or tensor weight.
Note
The shapes of input and end must be broadcastable.
If weight is a tensor, then the shapes of weight , start , and end must be broadcastable.
On the Ascend platform, if weight dtype is float, the type of input and end need to be float32.
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> start = mindspore.tensor([1., 2., 3., 4.], mindspore.float32) >>> end = mindspore.tensor([10., 10., 10., 10.], mindspore.float32) >>> output = mindspore.ops.lerp(start, end, 0.5) >>> print(output) [5.5 6. 6.5 7. ] >>> output = mindspore.ops.lerp(start, end, mindspore.tensor([0.5, 0.5, 0.5, 0.5], mindspore.float32)) >>> print(output) [5.5 6. 6.5 7. ]