mindspore/docs/api/api_python/ops/mindspore.ops.func_subtract...

23 lines
707 B
ReStructuredText
Raw Normal View History

2022-11-09 11:10:01 +08:00
mindspore.ops.subtract
=======================
2022-11-11 12:15:29 +08:00
.. py:function:: mindspore.ops.subtract(x, other, *, alpha=1)
2022-11-09 11:10:01 +08:00
对Tensor进行逐元素的减法。
.. math::
output[i] = x[i] - alpha * other[i]
参数:
- **x** (Union[Tensor, number.Number]) - 参与减法的Tensor或者Number。
- **other** (Union[Tensor, number.Number]) - 参与减法的Tensor或者Number。
关键字参数:
- **alpha** (Number) - :math:`other` 的乘数。默认值1。
返回:
Tensorshape与广播后的shape相同数据类型为输入中精度较高的类型。
异常:
- **TypeError** - `x``other` 不是Tensor、number.Number。