mindspore.mint.addbmm
- mindspore.mint.addbmm(input, batch1, batch2, *, beta=1, alpha=1)[source]
Apply batch matrix multiplication to batch1 and batch2, with a reduced add step and add input to the result.
Note
batch1 and batch2 must be 3-D tensors each containing the same number of matrices.
When batch1 is a \((C, W, T)\) tensor and batch2 is a \((C, T, H)\) tensor, input must be broadcastable with \((W, H)\) tensor, and out will be a \((W, H)\) tensor.
If beta is 0, then input will be ignored.
\[output = \beta input + \alpha (\sum_{i=0}^{b-1} {batch1_i @ batch2_i})\]Warning
This is an experimental API that is subject to change or deletion.
- Parameters
- Keyword Arguments
- Returns
Tensor
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> m = mindspore.mint.ones([3, 3]) >>> arr1 = mindspore.mint.arange(24.0).reshape((2, 3, 4)) >>> arr2 = mindspore.mint.arange(24.0).reshape((2, 4, 3)) >>> mindspore.mint.addbmm(m, arr1, arr2) Tensor(shape=[3, 3], dtype=Float32, value= [[ 9.49000000e+02, 1.00900000e+03, 1.06900000e+03], [ 1.28500000e+03, 1.37700000e+03, 1.46900000e+03], [ 1.62100000e+03, 1.74500000e+03, 1.86900000e+03]])