mindspore.mint.baddbmm
- mindspore.mint.baddbmm(input, batch1, batch2, *, beta=1, alpha=1)[source]
Perform a batch matrix-matrix product of matrices in batch1 and batch2 , input is added to the final 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 \((C, W, H)\) tensor, and out will be a \((C, W, H)\) tensor.
If beta is 0, then input will be ignored.
beta and alpha must be integers when inputs of type not FloatTensor.
\[\text{out}_{i} = \beta \text{input}_{i} + \alpha (\text{batch1}_{i} \mathbin{@} \text{batch2}_{i})\]- Parameters
- Keyword Arguments
- Returns
Tensor
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> input = mindspore.mint.ones([3, 3]) >>> batch1 = mindspore.mint.arange(24.0).reshape((2, 3, 4)) >>> batch2 = mindspore.mint.arange(24.0).reshape((2, 4, 3)) >>> mindspore.mint.baddbmm(input, batch1, batch2) Tensor(shape=[2, 3, 3], dtype=Float32, value= [[[ 4.30000000e+01, 4.90000000e+01, 5.50000000e+01], [ 1.15000000e+02, 1.37000000e+02, 1.59000000e+02], [ 1.87000000e+02, 2.25000000e+02, 2.63000000e+02]], [[ 9.07000000e+02, 9.61000000e+02, 1.01500000e+03], [ 1.17100000e+03, 1.24100000e+03, 1.31100000e+03], [ 1.43500000e+03, 1.52100000e+03, 1.60700000e+03]]])