---
title: 函数：create_handle_for_cast
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendgraphapi/aclpythondevg_01_0779.html
sourcePath: /source/zh/canncommercial/900/API/ascendgraphapi/aclpythondevg_01_0779.html
indexId: 7f614377ed54d8e957ed30ca549d514bc2eb6894b1e49e16604d6270860f578875
---
# 函数：create_handle_for_cast

#### 产品支持情况

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


#### 功能说明

创建数据类型转换的handle。

创建handle成功后，需调用acl.op.execute_with_handle接口执行算子。


#### 函数原型

- C函数原型
  1 aclError aclopCreateHandleForCast(const aclTensorDesc *srcDesc, const aclTensorDesc *dstDesc, uint8_t truncate, aclopHandle **handle)

- python函数
  1 handle, ret = acl.op.create_handle_for_cast(src_desc, dst_desc, truncate)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| src\_desc | int，输入Tensor描述指针地址。 |
| dst\_desc | int，输出Tensor描述指针地址。 |
| truncate | int，预留。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| handle | int，输出的handle的指针地址。 |
| ret | int，错误码，返回0表示成功，返回其它值表示失败。 |
