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

28 lines
1.3 KiB
ReStructuredText
Raw Normal View History

2022-11-03 20:24:21 +08:00
mindspore.ops.addcmul
======================
2023-03-04 23:21:06 +08:00
.. py:function:: mindspore.ops.addcmul(input, tensor1, tensor2, value=1)
2022-11-03 20:24:21 +08:00
2023-03-04 23:21:06 +08:00
执行Tensor `tensor1` 与Tensor `tensor2` 的逐元素乘积,将结果乘以标量值 `value` ,并将其添加到 `input` 中。
2022-11-03 20:24:21 +08:00
.. math::
2023-03-04 23:21:06 +08:00
output[i] = input[i] + value[i] * (tensor1[i] * tensor2[i])
2022-11-03 20:24:21 +08:00
参数:
2023-03-04 23:21:06 +08:00
- **input** (Tensor) - 要添加的Tensor。
- **tensor1** (Tensor) - 要乘以的Tensor。
- **tensor2** (Tensor) - 要乘以的Tensor。
- **value** (Union[Tensor, Number]) - tensor1 * tensor2的乘数。默认值1。
2022-11-03 20:24:21 +08:00
返回:
2023-03-04 23:21:06 +08:00
Tensor具有与tensor1*tensor2相同的shape和dtype。
2022-11-03 20:24:21 +08:00
异常:
2023-03-04 23:21:06 +08:00
- **TypeError** - 如果 `tensor1``tensor2``input` 不是Tensor。
- **TypeError** - 如果 `input` 的dtype不是float32、float16、int32之一。
- **TypeError** - 如果 `tensor1``tensor2` 的dtype不是float32、float16、int32之一.
2022-11-03 20:24:21 +08:00
- **TypeError** - 如果 `value` 的dtype不是float32、float16、int32之一。
2023-03-04 23:21:06 +08:00
- **ValueError** - 如果无法将 `tensor1` 广播到 `tensor2`
- **ValueError** - 如果无法将 `value` 广播到 `tensor1` * `tensor2`
- **ValueError** - 如果无法将 `input` 广播到 `value*(tensor1*tensor2)`