Slice

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

x

Atlas inference products

Atlas training products

Function Usage

Obtains tensor slices.

Prototype

const aclTensor *Slice(const aclTensor *x, const aclTensor *y, const aclTensor *offset, const aclTensor *size, aclOpExecutor *executor)
const aclTensor *Slice(const aclTensor *x, const aclIntArray *offsets, const aclIntArray *size, aclOpExecutor *executor)

Parameters

Parameter

Input/Output

Description

x

Input

Input tensor. The data type can be FLOAT16, FLOAT, BOOL, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, BFLOAT16, or UINT64. The data format can be ND.

NOTE:

BFLOAT16 applies to the following product models:

Atlas A2 training products/Atlas A2 inference products

Atlas A3 training products/Atlas A3 inference products

y

Output

Output tensor after slicing. The data type can be FLOAT16, FLOAT, BOOL, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, BFLOAT16, or UINT64. The data format can be ND.

NOTE:

BFLOAT16 applies to the following product models:

Atlas A2 training products/Atlas A2 inference products

Atlas A3 training products/Atlas A3 inference products

offsets

Input

const aclIntArray* type, indicating the start position of input x in each dimension slice. The shape is the dimensions of x. The data type can be INT32 or INT64, and the data format can be ND.

offset

Input

const aclTensor* type, indicating the start position of input x in each dimension slice. The shape is the dimensions of x. The data type can be INT32 or INT64, and the data format can be ND.

size

Input

Size of each dimension slice of input x. The shape is the dimensions of x. It can be of the aclIntArray* or aclTensor* type. The data type can be INT32 or INT64, and the data format can be ND.

executor

Input

Operator executor, containing the operator computation process.

Returns

A tensor of the same type as the input tensor and with the shape of size.

Constraints

None

Examples

1
2
3
4
// Call l0op::Slice to process each slice.
auto sliceRes = l0op::Slice(self, offsetArray, sizeArray, executor);
// Call l0op::Slice to process each slice.
auto sliceRes = l0op::Slice(xTensor, yTensor, offsetTensor, sizeTensor, executor);