使用MindSpore的ops中的矩阵相乘算子进行int8的相乘运算时报错
收藏回复举报
使用MindSpore的ops中的矩阵相乘算子进行int8的相乘运算时报错
发表于2023-12-19 16:45:17
0 查看

1 系统环境

硬件环境(Ascend/GPU/CPU): Ascend910

MindSpore版本: mindspore=2.2.0

执行模式(PyNative/ Graph):不限

Python版本: Python=3.9.2

操作系统平台: 不限

2 报错信息

2.1问题描述

使用mindspore2.2的ops中的矩阵相乘算子进行int8的相乘运算时,出现以下报错

TypeError:For primitive[MatMul], the input argument[x] must be a type of {Tensor[BFloat16], Tensor[Float16], Tensor[Float32], Tensor[Int32], Tensor[Int64], Tensor[UInt8]}, but got Tensor[Int8].

2.2 脚本代码

from mindspore import Tensor,ops
import numpy as np

ms.set_context(device_target="Ascend")
x = ms.Tensor(np.ones([1,3]).astype(np.int8))
x = ms.Tensor(np.ones([3,1]).astype(np.int8))
op = ops.matmul
z = op(x,y)
print(z)

3 根因分析

******此处由用户填写******

4 解决方案

******此处由用户填写******

包含文字方案和最终脚本代码

请将正确的脚本打包并上传附件

我要发帖子