Function: cast

Applicability

Product

Supported (√/x)

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

Casts the data type of a tensor. This API is asynchronous.

Prototype

  • C Prototype
    1
    aclError aclopCast(const aclTensorDesc *srcDesc, const aclDataBuffer *srcBuffer, const aclTensorDesc *dstDesc, aclDataBuffer *dstBuffer, uint8_t truncate, aclrtStream stream)
    
  • Python Function
    1
    ret = acl.op.cast(src_desc, src_buffer, dst_desc, dst_buffer, truncate, stream)
    

Parameter Description

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

Return Value

Description

ret

Int, error code: 0 on success; else, failure.

Reference

For the API call example, see API Call Sequence.