mindspore.mint.addbmm
- mindspore.mint.addbmm(input, batch1, batch2, *, beta=1, alpha=1)[source]
Applies batch matrix multiplication to batch1 and batch2, with a reduced add step and add input to the result.
The optional value alpha is the matrix-matrix product between batch1 and batch2, and beta is the scale factor for the added tensor input. If beta is 0, then input will be ignored.
Warning
This is an experimental API that is subject to change or deletion.
- Parameters
- Keyword Arguments
- Returns
Tensor, has the same dtype as input.
- Raises
TypeError – If alpha or beta is not an int or float.
ValueError – If batch1, batch2 cannot apply batch matrix multiplication.
ValueError – If batch1 and batch2 are not 3-D tensors.
- Supported Platforms:
Ascend
Examples
>>> import numpy as np >>> from mindspore import Tensor, mint >>> m = np.ones((3, 3)).astype(np.float32) >>> arr1 = np.arange(24).astype(np.float32).reshape((2, 3, 4)) >>> arr2 = np.arange(24).astype(np.float32).reshape((2, 4, 3)) >>> a = Tensor(arr1) >>> b = Tensor(arr2) >>> c = Tensor(m) >>> output = mint.addbmm(c, a, b) >>> print(output) [[ 949. 1009. 1069.] [1285. 1377. 1469.] [1621. 1745. 1869.]]