beta)torch_npu.npu_linear

接口原型

torch_npu.npu_linear(input, weight, bias=None) -> Tensor

功能描述

将矩阵“a”乘以矩阵“b”,生成“a*b”。

参数说明

支持的型号

调用示例

1
2
3
4
5
6
7
>>> x=torch.rand(2,16).npu()
>>> w=torch.rand(4,16).npu()
>>> b=torch.rand(4).npu()
>>> output = torch_npu.npu_linear(x, w, b)
>>> output
tensor([[3.6335, 4.3713, 2.4440, 2.0081],
        [5.3273, 6.3089, 3.9601, 3.2410]], device='npu:0')