Function: cast
Applicable Products
- Ascend 950PR&950DT products: Not supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Function
Casts the data type of a tensor. This API is asynchronous.
Prototype
-
C Prototype
aclError aclopCast(const aclTensorDesc *srcDesc, const aclDataBuffer *srcBuffer, const aclTensorDesc *dstDesc, aclDataBuffer *dstBuffer, uint8_t truncate, aclrtStream stream) -
Python Function
ret = acl.op.cast(src_desc, src_buffer, dst_desc, dst_buffer,truncate, stream)
Parameters
| Parameter | Description |
|---|---|
| src_desc | Int, pointer address of the input tensor description. |
| src_buffer | Int, input tensor, the aclDataBuffer pointer address created by calling acl.create_data_buffer. |
| dst_desc | Int, pointer address of the output tensor description. |
| dst_buffer | Int, output tensor, the aclDataBuffer pointer address created by calling acl.create_data_buffer. |
| truncate | Int, reserved. |
| stream | Int, stream where the operator is executed, stream address object. |
Return Values
| Return Value | Description |
|---|---|
| ret | Int, error code: 0 on success; else, failure. |
Reference
For the API call example, see API Calling Process.