---
title: 函数：get_op_type
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/API/runtimeapi/aclpythondevg_01_0879.html
sourcePath: /source/zh/CANNCommunityEdition/920beta1/API/runtimeapi/aclpythondevg_01_0879.html
indexId: 6c113b8b036f2e41cf7bbf59c1afad043fa752de7969dcd93b8ed2448b35d37682
---
# 函数：get_op_type

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Ascend 950PR / Ascend 950DT | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |


#### 功能说明

获取指定算子的算子类型名称。

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

acl.prof.get_op_type和acl.prof.get_op_type_v2接口功能一致，但acl.prof.get_op_type_v2接口会获取算子类型长度，并分配相应的空间，不需要用户传参来指定算子类型所需空间大小，建议优先使用acl.prof.get_op_type_v2接口。


#### 函数原型

- C函数原型
  1 aclError aclprofGetOpType(const void *opInfo, size_t opInfoLen, uint32_t index, char *opType, size_t opTypeLen)

- python函数
  1 op_type, ret = acl.prof.get_op_type(op_info, op_info_len, index, op_type_len)


#### 参数说明

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


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| op\_type | str，算子类型名称。 |
| ret | int，错误码。 返回0表示成功。 返回其它值表示失败。 |
