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

#### 产品支持情况

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


#### 功能说明

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

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


#### 函数原型

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

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


#### 参数说明

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


#### 返回值说明

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