mindspore/docs/api/api_python/ops/mindspore.ops.func_lerp.rst

36 lines
1.7 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.lerp
==================
.. py:function:: mindspore.ops.lerp(start, end, weight)
基于某个浮点数或权重Tensor的值, 计算两个Tensor之间的线性插值。
如果参数 `weight` 是一个Tensor那么另两个输入的维度信息可以被广播到 `start`
如果参数 `weight` 是一个浮点数, 那么 `end` 的维度信息可以被广播到 `start`
.. math::
output_{i} = start_{i} + weight_{i} * (end_{i} - start_{i})
**参数:**
- **start** (Tensor) - 进行线性插值的Tensor开始点其数据类型必须为float16或者float32。
- **end** (Tensor) - 进行线性插值的Tensor结束点其数据类型必须为float16或者float32。
- **weight** (Union[float, Tensor]) - 线性插值公式的权重参数。为Scalar时其数据类型为float。为Tensor时其数据类型为float16或者float32。
**返回:**
Tensor, 其数据类型和维度必须和输入中的 `start` 保持一致。
**异常:**
- **TypeError** - 如果 `start` 或者 `end` 不是Tensor。
- **TypeError** - 如果 `weight` 不是float类型Scalar或者Tensor。
- **TypeError** - 如果 `start` 或者 `end` 的数据类型不是float16或者float32。
- **TypeError** - 如果 `weight` 为Tensor且 `weight` 不是float16或者float32。
- **TypeError** - 如果 `start``end` 的数据类型不一致。
- **TypeError** - 如果 `weight` 为Tensor且 `start``end``weight` 数据类型不一致。
- **ValueError** - 如果 `end` 的维度信息无法相互广播到 `start`
- **ValueError** - 如果 `weight` 为Tensor且 `weight` 的维度信息无法广播到 `start`