matmul¶
- dragon.vm.torch.- matmul(
 input,
 other,
 out=None
 )[source]¶
- Compute the matrix multiplication. \[\text{out} = \text{input} \times \text{other} \]- The behavior depends on the shape of input tensors: - If both tensors are 1d, computes the vector product.
- If tensors are 1d and >=2d, computes the vector-matrix multiplication.
- If tensors are >=2d and 1d, computes the matrix-vector multiplication.
- If both tensors are >= 2d, computes the matrix-matrix multiplication.
- If one tensor is >= 3d, applies batching and broadcasting to the computation.
 - Examples: - # Vector x Vector a = torch.ones(2) b = torch.ones(2) print(torch.matmul(a, b)) # Vector x Matrix a = torch.ones(2) b = torch.ones(2, 3) print(torch.matmul(a, b)) # Matrix x Vector a = torch.ones(3, 2) b = torch.ones(2) print(torch.matmul(a, b)) # Matrix x Matrix a = torch.ones(2, 3) b = torch.ones(3, 2) print(torch.matmul(a, b)) - Parameters:
- input (dragon.vm.torch.Tensor) – The input tensor.
- other (dragon.vm.torch.Tensor) – The tensor to multiply.
- out (dragon.vm.torch.Tensor, optional) – The output tensor.
 
 - Returns:
- dragon.vm.torch.Tensor – The output tensor. 
 
