|
3399pro运行多次后失败或崩溃是什么原因?
我使用的安卓平台交替跑两个模型,大概三五百次会运行失败,请教是什么原因?
我查看了返回值类型:
#define RKNN_ERR_DEVICE_UNAVAILABLE -3 /* device is unavailable. */
#define RKNN_ERR_MALLOC_FAIL -4 /* memory malloc fail. */
看了内存也有释放的,调用程序使用的是demo如下:bool run_ssd(char *inData, float *y0, float *y1)
{
if(!created) {
LOGE("run_ssd: create hasn't successful!");
return false;
}
rknn_input inputs[1];
inputs[0].index = input_index;
inputs[0].buf = inData;
inputs[0].size = img_width * img_height * img_channels;
inputs[0].pass_through = false;
inputs[0].type = RKNN_TENSOR_UINT8;
inputs[0].fmt = RKNN_TENSOR_NHWC;
int ret = rknn_inputs_set(ctx, 1, inputs);
if(ret < 0) {
LOGE("rknn_input_set fail! ret=%d\n", ret);
return false;
}
ret = rknn_run(ctx, nullptr);
if(ret < 0) {
LOGE("rknn_run fail! ret=%d\n", ret);
return false;
}
rknn_output outputs[2];
#if 1
outputs[0].want_float = true;
outputs[0].is_prealloc = true;
outputs[0].index = output_index0;
outputs[0].buf = y0;
outputs[0].size = output_size0;
outputs[1].want_float = true;
outputs[1].is_prealloc = true;
outputs[1].index = output_index1;
outputs[1].buf = y1;
outputs[1].size = output_size1;
#else // for workround the wrong order issue of output index.
outputs[0].want_float = true;
outputs[0].is_prealloc = true;
outputs[0].index = output_index0;
outputs[0].buf = y1;
outputs[0].size = output_size1;
outputs[1].want_float = true;
outputs[1].is_prealloc = true;
outputs[1].index = output_index1;
outputs[1].buf = y0;
outputs[1].size = output_size0;
#endif
ret = rknn_outputs_get(ctx, 2, outputs, nullptr);
if(ret < 0) {
LOGE("rknn_outputs_get fail! ret=%d\n", ret);
return false;
}
rknn_outputs_release(ctx, 2, outputs);
return true;
}
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|