---
title: 对标算子
description: "本OP对标torch库中的matmul算子，功能略有不同。部分对标的功能参考torch.matmul文档(https://pytorch.org/docs/stable/generated/torch.matmul.html)中的示例："
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendtb/ascendtb_01_0157.html
sourcePath: /source/zh/canncommercial/900/API/ascendtb/ascendtb_01_0157.html
indexId: 9080d2c3fdd64c7d426e0e85a1916246516965f5fa4aade978e417bba4f7791164
---
# 对标算子

本OP对标torch库中的matmul算子，功能略有不同。部分对标的功能参考torch.matmul文档(https://pytorch.org/docs/stable/generated/torch.matmul.html)中的示例：

```
# batched matrix x batched matrix
tensor1 = torch.randn(10, 3, 4)
tensor2 = torch.randn(10, 4, 5)
torch.matmul(tensor1, tensor2).size() # torch.Size([10, 3, 5])
# batched matrix x broadcasted matrix
tensor1 = torch.randn(10, 3, 4)
tensor2 = torch.randn(4, 5)
torch.matmul(tensor1, tensor2).size() # torch.Size([10, 3, 5])
```
