1 系统环境
硬件环境(Ascend/GPU/CPU): Ascend/GPU/CPU
MindSpore Lite版本: mindspore Lite=1.10.0
执行模式(PyNative/ Graph):不限
Python版本: Python=3.7
操作系统平台: 不限
2 报错信息
2.1 问题描述
使用 CrossEntropyLoss 或者 NLLLoss 作为损失函数时,通过 converter 工具转换训练模型报错,错误信息:encounter an unknown error, please verify the input model file or build the debug version。如果换成 MSELoss 就可以转换成功。
2.2 报错信息
2.3 脚本代码(代码格式,可上传附件)
3 根因分析
******此处由用户补充详细的定位过程******
4 解决方案

包含文字方案和最终脚本代码
请将正确的脚本打包并上传附件
1 系统环境
硬件环境(Ascend/GPU/CPU): Ascend/GPU/CPU
MindSpore Lite版本: mindspore Lite=1.10.0
执行模式(PyNative/ Graph):不限
Python版本: Python=3.7
操作系统平台: 不限
2 报错信息
2.1 问题描述
使用 CrossEntropyLoss 或者 NLLLoss 作为损失函数时,通过 converter 工具转换训练模型报错,错误信息:encounter an unknown error, please verify the input model file or build the debug version。如果换成 MSELoss 就可以转换成功。
2.2 报错信息
2.3 脚本代码(代码格式,可上传附件)
from mindspore import Tensor, nn import mindspore import numpy as np class Network(nn.Cell): def __init__(self): super().__init__() self.fc1 = nn.Dense(in_channels=10, out_channels=10, activation='relu') self.fc2 = nn.Dense(in_channels=10, out_channels=5, activation='relu') def construct(self, x: Tensor): x = self.fc1(x) x = self.fc2(x) return x model = Network() # Instantiate loss function and optimizer loss_fn = nn.CrossEntropyLoss() optimizer = nn.SGD(model.trainable_params(), 1e-2, momentum=0.9) example_input = Tensor(np.ones((1, 10), dtype=np.float32)) model.set_train(False) mindspore.export(model, example_input, file_format='MINDIR', file_name='debug_predict') # export trainable model model.set_train(True) example_label = Tensor(np.ones((1), dtype=np.int32)) loss_net = nn.WithLossCell(backbone=model, loss_fn=loss_fn) train_net = nn.TrainOneStepCell(network=loss_net, optimizer=optimizer) mindspore.export(train_net, example_input, example_label, file_format='MINDIR', file_name='debug_train') print('导出模型完成')3 根因分析
******此处由用户补充详细的定位过程******
4 解决方案
包含文字方案和最终脚本代码
请将正确的脚本打包并上传附件