昇腾社区首页
中文
注册

函数:execute_v2

C函数原型

aclError aclmdlExecuteV2(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output, aclrtStream stream,const aclmdlExecConfigHandle* handle)

Python函数

ret = acl.mdl.execute_v2(model_id, input, output, stream, handle)

函数功能

根据acl.mdl.set_exec_config_opt接口所配置的属性,执行模型推理,直到返回推理结果。该接口是在acl.mdl.execute接口基础上进行了增强,支持在执行模型推理时控制Stream任务的超时时间、Event任务的超时时间。

输入说明

model_id:int,指定需要执行推理的模型的ID。调用acl.mdl.load_from_file接口/acl.mdl.load_from_mem接口/acl.mdl.load_from_file_with_mem接口/acl.mdl.load_from_mem_with_mem接口加载模型成功后,会返回模型ID。

input:int,模型推理的输入数据的指针地址。

output:int,模型推理的输出数据的指针地址。

stream:int,指定已创建的Stream指针地址,如需指定新的Stream,可通过acl.rt.create_stream等接口创建并获取Stream指针地址。

handle:int,模型执行的配置对象的指针地址。与acl.mdl.set_exec_config_opt中的handle保持一致。

返回值说明

ret:int,错误码。

  • 返回0表示成功。
  • 返回其它值表示失败。

约束说明

参考资源