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

#### 产品支持情况

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


#### 功能说明

获取指定内存中算子的数量。

建议用户新建一个线程，在新线程内调用该接口，否则可能阻塞主线程中的其它任务调度。


#### 函数原型

- C函数原型
  1 aclError aclprofGetOpNum(const void *opInfo, size_t opInfoLen, uint32_t *opNumber)

- python函数
  1 op_num, ret = acl.prof.get_op_num(op_info, op_info_len)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| op\_info | int，指定算子信息的内存地址。 调用acl.prof.get\_op\_desc\_size接口获取到单个算子数据结构的大小后，用户需按照“单个算子数据结构的大小\*整数系数”得到的数值申请内存，用于存放Profiling采集到的算子信息数据，作为本接口的输入。 |
| op\_info\_len | int，算子信息的长度。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| op\_num | int，算子的数量。 |
| ret | int，错误码。 返回0表示成功。 返回其它值表示失败。 |
