acltdtGetSliceInfoFromItem

Applicable Products

Product

Supported

Ascend 950PR/Ascend 950DT

√

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

√

Function

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.