auto inputs = OH_AI_ModelGetInputs(model);
int n1 = 1;
int n2 = 8;
OH_AI_ShapeInfo *shape_infos = new OH_AI_ShapeInfo[3];
shape_infos[0].shape_num = 2;
shape_infos[0].shape[0] = n1;
shape_infos[0].shape[1] = n2;
shape_infos[1].shape_num = 2;
shape_infos[1].shape[0] = n1;
shape_infos[1].shape[1] = n2;
shape_infos[2].shape_num = 2;
shape_infos[2].shape[0] = n1;
shape_infos[2].shape[1] = n2;
auto modelResizeInputs = OH_AI_ModelResize(model, inputs, shape_infos, 3);
auto ret = FillInputTensor(inputs, input_data);
auto predict_ret = OH_AI_ModelPredict(model, inputs, &outputs, nullptr, nullptr);
if (predict_ret != OH_AI_STATUS_SUCCESS) {
OH_AI_ModelDestroy(&model);
LOGE("MS_LITE_ERR: MSLite Predict error.\n");
return OH_AI_STATUS_LITE_ERROR;
}
日志输出:
E signal_chain_handler call 2 rd sigchain action for signal: 11 sca_sigaction=5b31a4d874 noreturn=0 FREEZE_signo_11 thread_list_lock_status:-1 tl_lock_count=0 tl_lock_waiters=0 tl_lock_tid_fail=-1 tl_lock_count_tid=-1
E [mindspore/lite/src/litert/kernel/cpu/fp16/cast_fp16.cc:102] DoCast# Unsupported output data type 30
E [mindspore/lite/src/litert/kernel/cpu/fp16/cast_fp16.cc:102] DoCast# Unsupported output data type 30
E [mindspore/lite/src/litert/lite_kernel.cc:133] Execute# run kernel failed, name: /bert/Cast_1
E [mindspore/lite/src/executor/sub_graph_kernel.cc:473] Execute# run kernel failed, name: /bert/Cast_1
E [mindspore/lite/src/litert/lite_mindrt.cc:48] RunOpData# run kernel failed, name: CpuFP16SubGraph3_7
E signal_chain_handler call usr sigaction for signal: 11 sig_action.sa_sigaction=00000000B5217330
E [mindspore/lite/src/litert/mindrt_executor.cc:334] Run# MindrtRun failed
E [mindspore/lite/src/litert/lite_session.cc:887] RunGraph# RunGraph failed : -1
E [mindspore/lite/src/litert/cxx_api/model/model_impl.cc:525] Predict# Run graph failed.
E signal_chain_handler call 2 rd sigchain action for signal: 11 sca_sigaction=5b31a4d874 noreturn=0 FREEZE_signo_11 thread_list_lock_status:-1 tl_lock_count=0 tl_lock_waiters=0 tl_lock_tid_fail=-1 tl_lock_count_tid=-1
E signal_chain_handler SIG_DFL handler for signal: 11
机型:华为META60
系统:ARM架构
场景:导出MacBert模型,用鸿蒙的MindSpore Lite 调用模型执行推理
代码:
auto inputs = OH_AI_ModelGetInputs(model); int n1 = 1; int n2 = 8; OH_AI_ShapeInfo *shape_infos = new OH_AI_ShapeInfo[3]; shape_infos[0].shape_num = 2; shape_infos[0].shape[0] = n1; shape_infos[0].shape[1] = n2; shape_infos[1].shape_num = 2; shape_infos[1].shape[0] = n1; shape_infos[1].shape[1] = n2; shape_infos[2].shape_num = 2; shape_infos[2].shape[0] = n1; shape_infos[2].shape[1] = n2; auto modelResizeInputs = OH_AI_ModelResize(model, inputs, shape_infos, 3); auto ret = FillInputTensor(inputs, input_data); auto predict_ret = OH_AI_ModelPredict(model, inputs, &outputs, nullptr, nullptr); if (predict_ret != OH_AI_STATUS_SUCCESS) { OH_AI_ModelDestroy(&model); LOGE("MS_LITE_ERR: MSLite Predict error.\n"); return OH_AI_STATUS_LITE_ERROR; }日志输出: