Function: cast

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)

Function Usage

Converts the data type of the input tensor. This API is asynchronous.

Input 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 Value

ret: int, error code.

Restrictions

None

Reference

For details about the API call example, see API Call Sequence.