问题描述:
【功能模块】
MindSpore - 模型导出 - AIR模型导出
【操作步骤&问题现象】
1、脚本在GPU和Ascend环境下正常运行,可以正常运行,结果也正常
2、Ascend中导出AIR模型时遭遇select算子Cast错误,脚本中并未使用select算子
【截图信息】
【日志信息】
[WARNING] GE_ADPT(143,python):2021-03-12-15:15:58.486.295 [mindspore/ccsrc/transform/graph_ir/op_adapter_util.cc:134] VectorToTensorUtil] Convert a none tuple to an empty ge tensor
[ERROR] GE_ADPT(143,python):2021-03-12-15:15:58.498.824 [mindspore/core/ir/anf.h:431] GetValue] Cast failed, original value: 101, type: Int32Imm
Traceback (most recent call last):
File "/home/work/user-job-dir/BLSBasic/BLSBasicTrainFor_1_0.py", line 325, in
export(bls, train_data, train_label, file_name="bls.air", file_format='AIR')
File "/usr/local/ma/python3.7/lib/python3.7/site-packages/mindspore/train/serialization.py", line 537, in export
_export(net, file_name, file_format, *inputs)
File "/usr/local/ma/python3.7/lib/python3.7/site-packages/mindspore/train/serialization.py", line 562, in _export
graph_id, _ = _executor.compile(net, *inputs, phase=phase_name)
File "/usr/local/ma/python3.7/lib/python3.7/site-packages/mindspore/common/api.py", line 537, in compile
self._build_data_graph(obj, phase)
File "/usr/local/ma/python3.7/lib/python3.7/site-packages/mindspore/common/api.py", line 388, in _build_data_graph
self._executor.build_data_graph(obj.parameters_dict(), phase, obj.parameters_broadcast_dict())
RuntimeError: mindspore/core/ir/anf.h:431 GetValue] Cast failed, original value: 101, type: Int32Imm
# In file /usr/local/ma/python3.7/lib/python3.7/site-packages/mindspore/ops/composite/multitype_ops/_compile_utils.py(504)
return F.select(condition, u, data)
解决方案:
上述问题在MindSpore1.2版本中已得到修复,可以正常使用。