大家好、
我使用 TIDLRT 去政治我的模型 AM62A . 当模型有多个输出时、TIDLRT_invoke 卡住。 这是我的模型。

这是目标日志。

关于内存 malloc、我的代码类似这样。
sTIDLRT_Tensor_t *in[16];
sTIDLRT_Tensor_t *out[16];
sTIDLRT_Tensor_t in_tensor;
sTIDLRT_Tensor_t out_tensor;
sTIDLRT_Tensor_t out_tensor2;
int32_t j = 0;
in[j] = &in_tensor;
status = TIDLRT_setTensorDefault(in[j]);
//in[j]->layout = TIDLRT_LT_NHWC;
in[j]->layout = TIDLRT_LT_NCHW;
//strcpy((char *)in[j]->name, tensor->name);
in[j]->elementType = TIDLRT_Uint8;
int32_t in_tensor_szie = 32 * 32 * 3 * sizeof(uint8_t);
if (device_mem)
{
in[j]->ptr = TIDLRT_allocSharedMem(64, in_tensor_szie);
in[j]->memType = TIDLRT_MEM_SHARED;
}
else
{
in[j]->ptr = malloc(in_tensor_szie);
}
memcpy(in[j]->ptr,input_data,input_size);
for (size_t idx = 0; idx < 8; idx++)
{
printf("%x ",input_data[idx]);
}
printf("\n");
out[j] = &out_tensor;
status = TIDLRT_setTensorDefault(out[j]);
out[j]->layout = TIDLRT_LT_NCHW;
//strcpy((char *)in[j]->name, tensor->name);
out[j]->elementType = TIDLRT_Float32;
int32_t out_tensor_szie = 2 * 34 * 34 * sizeof(float);
if (device_mem)
{
out[j]->ptr = TIDLRT_allocSharedMem(64, out_tensor_szie);
out[j]->memType = TIDLRT_MEM_SHARED;
}
else
{
out[j]->ptr = malloc(out_tensor_szie);
}
j = 1;
out_tensor_szie = 8 * 34 * 34 * sizeof(float);
out[j] = &out_tensor2;
status = TIDLRT_setTensorDefault(out[j]);
out[j]->layout = TIDLRT_LT_NCHW;
//strcpy((char *)in[j]->name, tensor->name);
out[j]->elementType = TIDLRT_Float32;
//int32_t out_tensor_szie = 1001 * sizeof(float);
if (device_mem)
{
out[j]->ptr = TIDLRT_allocSharedMem(64, out_tensor_szie);
out[j]->memType = TIDLRT_MEM_SHARED;
}
else
{
out[j]->ptr = malloc(out_tensor_szie);
}
LOG(INFO) << "invoked \n";
struct timeval start_time, stop_time;
gettimeofday(&start_time, nullptr);
int loop_count = 1;
for (int i = 0; i < loop_count; i++)
{
TIDLRT_invoke(handle, in, out);
}
gettimeofday(&stop_time, nullptr);
我找不到原因。
您能否使用 TIDL-RT?为部署多个输出提供示例代码?
谢谢!
亨利