---
title: 函数：model_subscribe
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclpythondevg_01_0872.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0872.html
indexId: 704d11a1470d9a3d6ba6fcc370a4ffb35f6db67723726415509350baf7676bf671
---
# 函数：model_subscribe

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |


#### 功能说明

网络场景下，订阅算子的基本信息，包括算子名称、算子类型、算子执行耗时等。


#### 函数原型

- C函数原型
  1 aclError aclprofModelSubscribe(uint32_t modelId, const aclprofSubscribeConfig *profSubscribeConfig)

- python函数
  1 ret = acl.prof.model_subscribe(model_id, subscribe_config)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| model\_id | int，待订阅的网络模型的ID。调用acl.mdl.load\_from\_file(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/ascendgraphapi/aclpythondevg\_01\_0149.html)接口/acl.mdl.load\_from\_mem(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/ascendgraphapi/aclpythondevg\_01\_0140.html)接口/acl.mdl.load\_from\_file\_with\_mem(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/ascendgraphapi/aclpythondevg\_01\_0141.html)接口/acl.mdl.load\_from\_mem\_with\_mem(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/ascendgraphapi/aclpythondevg\_01\_0142.html)接口加载模型成功后，会返回模型ID。 |
| subscribe\_config | int，待订阅的配置信息。调用acl.prof.create\_subscribe\_config接口创建配置数据。 |


#### 返回值说明

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


#### 约束说明

需要与acl.prof.model_unsubscribe接口配对使用。
