# tensorplay.functional.bmm Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.bmm.html ```python tensorplay.functional.bmm(input, mat2, out_dtype=None, *, out=None) → Tensor ``` Performs a batch matrix-matrix product of matrices stored in input and mat2. input and mat2 must be 3-D tensors each containing the same number of matrices. If input is a $(b \times n \times m)$ tensor, mat2 is a $(b \times m \times p)$ tensor, out will be a $(b \times n \times p)$ tensor. $$\text{out}_i = \text{input}_i \mathbin{@} \text{mat2}_i$$ This operator supports [TensorFloat32](/docs/notes/numerical_accuracy.html#id6). On certain ROCm devices, when using float16 inputs this module will use [different precision](/docs/notes/numerical_accuracy.html#fp16-on-mi200) for backward. > **Note** > > This function does not broadcast. For broadcasting matrix products, see tensorplay.matmul(). Parameters: - input ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – the first batch of matrices to be multiplied - mat2 ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – the second batch of matrices to be multiplied - out_dtype ([dtype](/docs/generated/tensorplay.DType.html#tensorplay.DType), optional) – the dtype of the output tensor, Supported only on CUDA and for tensorplay.float32 given tensorplay.float16/tensorplay.bfloat16 input dtypes Keyword Arguments: out ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor), optional) – the output tensor. Example: ``` >>> input = tensorplay.randn(10, 3, 4) >>> mat2 = tensorplay.randn(10, 4, 5) >>> res = tensorplay.bmm(input, mat2) >>> res.size() tensorplay.Size([10, 3, 5]) ```