acltdtGetSliceInfoFromItem

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

Outputs the tensor slice information.

Application scenario: The OutfeedEnqueueOpV2 operator requires the allocation of a large block of memory on the device to store data. If the device memory is insufficient, memory allocation may fail and cause some operators to fail to execute normally. In this case, you can call this API to obtain tensor slice information (slice count and slice index), and then splice the operator tensor data based on the slice information.

Prototype

aclError acltdtGetSliceInfoFromItem(const acltdtDataItem *dataItem, size_t *sliceNum, size_t* sliceId)

Parameters

Parameter

Input/Output

Description

dataItem

Input

Pointer to data of the acltdtDataItem type. acltdtDataItem is used to identify a tensor of a service.

Call acltdtCreateDataItem to create data of the acltdtDataItem type in advance.

sliceNum

Output

Number of slices of a single tensor.

sliceId

Output

Data slice index of the sliced tensor.

Returns

0 on success; else, failure. For details, see aclError.