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

#### 产品支持情况

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


#### 功能说明

获取算子名称的字符串长度，用于内存申请。

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


#### 函数原型

- C函数原型
  1 aclErroraclprofGetOpNameLen(const void *opInfo, size_t opInfoLen, uint32_t index, size_t *opNameLen)

- python函数
  1 opNameLen, ret = acl.prof.get_op_name_len(opInfo, opInfoLen, index)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| opInfo | int，包含算子信息的地址。 |
| opInfoLen | int，算子信息的长度。 |
| index | int，指定获取第几个算子的算子名称长度。 用户调用acl.prof.get\_op\_num接口获取算子数量后，这个index的取值范围：[0, (算子数量\-1)]。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| opNameLen | int，opName的实际内存申请长度。 |
| ret | int，错误码。 返回0表示成功。 返回其它值表示失败。 |
