---
title: 函数：set_exec_config_opt
description: "设置模型执行的配置对象中的各属性的取值。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendgraphapi/aclpythondevg_01_0167.html
sourcePath: /source/zh/canncommercial/900/API/ascendgraphapi/aclpythondevg_01_0167.html
indexId: f76d7ae792c173f772c54e1b5e5d3ea4a769135bc152d45f498cd3036d03c72875
---
# 函数：set_exec_config_opt

#### 功能说明

设置模型执行的配置对象中的各属性的取值。


#### 函数原型

- C函数原型
  1 aclError aclmdlSetExecConfigOpt(aclmdlExecConfigHandle *handle, aclmdlExecConfigAttr attr, const void *attrValue, size_t valueSize)

- python函数
  1 ret = acl.mdl.set_exec_config_opt(handle, attr, attrValue)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| handle | int，模型执行的配置对象的指针地址。需提前调用acl.mdl.create\_exec\_config\_handle接口创建该对象的指针地址。 |
| attr | int，指定需设置的属性。具体请参见aclmdlExecConfigAttr。 |
| attrValue | int，“attr”对应的属性取值。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| ret | int，错误码，返回0表示成功，返回其它值表示失败。 |


#### 约束说明

本接口需要配合其它接口一起使用，实现模型执行，接口调用顺序如下：1. 调用  acl.mdl.create_exec_config_handle
接口创建模型执行的配置对象。
2. 多次调用  acl.mdl.set_exec_config_opt
接口设置配置对象中每个属性的值。
3. 调用  acl.mdl.execute_v2
接口指定模型执行时需要的配置信息，并进行模型执行。
4. 模型加载成功后，调用  acl.mdl.destroy_exec_config_handle
接口销毁。
