acltdtGetSliceInfoFromItem

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

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

1
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. For details about the type definition, see acltdtDataItem.

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; otherwise, failure. For details, see aclError.