You're reading an pre-release version of this documentation.
For the latest stable release version, please have a look at master.

Function create_app_ctx

Function Documentation

app_ctx_t *create_app_ctx(buffer_t *nbg_buffer, preprocess_cb model_preprocess, postprocess_cb model_postprocess)

创建并初始化一个 app_ctx_t 推理上下文,加载量化网络并分配推理所需资源

参数:
  • nbg_buffer -- [IN] 指向 NBG 二进制数据的缓冲区结构体指针

  • model_preprocess -- [IN] 前处理函数指针,可为 NULL(若模型不需要前处理)

  • model_postprocess -- [IN] 后处理函数指针,用于处理推理结果

返回:

app_ctx_t*

  • 非 NULL:创建成功,返回已初始化的 app_ctx_t 指针;

  • NULL:创建失败,例如模型加载或资源分配出错。