Function: create_tensor_desc

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

Creates data of the aclTensorDesc type as a tensor description, describing the data type, shape, and format of a tensor.

To destroy data of the aclTensorDesc type, call Function: destroy_tensor_desc.

Prototype

  • C Prototype
    1
    aclTensorDesc *aclCreateTensorDesc(aclDataType dataType, int numDims, const int64_t *dims, aclFormat format)
    
  • Python Function
    1
    tensor_desc = acl.create_tensor_desc(data_type, dims, format)
    

Parameter Description

Parameter

Description

data_type

Int, data type of the tensor description.

dims

List, size of the specified dimensions of the tensor description. dims is a list of ints. Each element in the list indicates the size of each dimension in the tensor. If the value of an element is 0, the tensor is empty. If you need to use an empty tensor, set the minimum memory size to 1 byte during memory allocation to ensure normal running of subsequent services.

format

Int, format of the tensor description.

Return Value Description

Return Value

Description

tensor_desc

Int, address object for creating the tensor description.