acltdtGetSliceInfoFromItem
The
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
The value 0 indicates success, and other values indicate failure. For details, see aclError.