aclCreateTensorDesc

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

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 aclDestroyTensorDesc.

Prototype

aclTensorDesc *aclCreateTensorDesc(aclDataType dataType,
int numDims,
const int64_t *dims,
aclFormat format)

Parameters

Parameter

Input/Output

Description

dataType

Input

Data type of the tensor description.

numDims

Input

Tensor dimension count.

numDims has the following restrictions:

  • numDims >= 0
  • If numDims > 0, then numDims must be the same as the length of the dims array.
  • If numDims = 0, the system does not use the dims array value and the dims parameter value is invalid.

dims

Input

Pointer to the size of the tensor dimension.

dims is an array. Each element in the array corresponds to the size of a 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

Input

Tensor format.

Returns

Pointer to data of the aclTensorDesc type.