问题描述:BatchMatMulV3算子是cann自带算子,可以通过atc单算子进行导出验证。但是缺在onnx->om图转换时出错
复现方法:
a) 环境确认:基于 atc --singleop=./bmm_v3.json --output=./out/ --soc_version=Ascend310P3 --op_debug_level=1 --dump_mode=1能正确导出bmmv3单算子模型,说明当前cann包中已经默认集成了BatchMatMulV3算子,参考https://www.hiascend.com/forum/thread-02112174231490433006-1-1.html
CANN版本为 20241230 的每日验证版本:https://cmc-szv.clouddragon.huawei.com/cmcversion/index/findSnapshotRelease?deltaId=11850647311527168&isSelect=SrcBaseline
b) 基于附件onnx_bmmv3_model.py.txt 执行 python onnx_bmmv3_model.py 能生成 BatchMatMulV3算子的onnx模型图 batchmatmulv3.onnx

c) 执行atc --model=batchmatmulv3.onnx --framework=5 --output=batchmatmulv3 --soc_version=Ascend310P3异常,找不到算子BatchMatMulV3

补充说明:在执行上述python onnx_bmmv3_model.py时也是存在RuntimeError,但因为生成了正确的batchmatmulv3.onnx模型图,因此暂时忽略
[root@huawei-pc batchmatmulv2_input]# python onnx_bmmv3_model.py
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/torch/onnx/utils.py", line 1686, in _export
_C._check_onnx_proto(proto)
RuntimeError: No Op registered for BatchMatMulV3 with domain_version of 11
==> Context: Bad node spec for node. Name: /BatchMatMulV3 OpType: BatchMatMulV3
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/zhongyunde/Wireless-Software-Platform-MultiModal-Optimization/ITS/NPU-OPS/src/ops/tik/tbe/impl/batchmatmulv2_input/onnx_bmmv3_model.py", line 56, in <module>
export()
File "/home/zhongyunde/Wireless-Software-Platform-MultiModal-Optimization/ITS/NPU-OPS/src/ops/tik/tbe/impl/batchmatmulv2_input/onnx_bmmv3_model.py", line 43, in export
torch.onnx.export(
File "/usr/lib/python3.10/site-packages/torch/onnx/utils.py", line 516, in export
_export(
File "/usr/lib/python3.10/site-packages/torch/onnx/utils.py", line 1688, in _export
raise errors.CheckerError(e) from e
torch.onnx.errors.CheckerError: No Op registered for BatchMatMulV3 with domain_version of 11
==> Context: Bad node spec for node. Name: /BatchMatMulV3 OpType: BatchMatMulV3
问题描述:BatchMatMulV3算子是cann自带算子,可以通过atc单算子进行导出验证。但是缺在onnx->om图转换时出错
复现方法:
a) 环境确认:基于 atc --singleop=./bmm_v3.json --output=./out/ --soc_version=Ascend310P3 --op_debug_level=1 --dump_mode=1能正确导出bmmv3单算子模型,说明当前cann包中已经默认集成了BatchMatMulV3算子,参考https://www.hiascend.com/forum/thread-02112174231490433006-1-1.html
CANN版本为 20241230 的每日验证版本:https://cmc-szv.clouddragon.huawei.com/cmcversion/index/findSnapshotRelease?deltaId=11850647311527168&isSelect=SrcBaseline
b) 基于附件onnx_bmmv3_model.py.txt 执行 python onnx_bmmv3_model.py 能生成 BatchMatMulV3算子的onnx模型图 batchmatmulv3.onnx
c) 执行atc --model=batchmatmulv3.onnx --framework=5 --output=batchmatmulv3 --soc_version=Ascend310P3异常,找不到算子BatchMatMulV3
补充说明:在执行上述python onnx_bmmv3_model.py时也是存在RuntimeError,但因为生成了正确的batchmatmulv3.onnx模型图,因此暂时忽略