Function: create_tensor_desc

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

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)
    

Parameters

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.

Returns

Return Value

Description

tensor_desc

Int, address object for creating the tensor description.