# DynamicSlice#

## DynamicSlice - 1#

Version

• domain: main

• since_version: 1

• function:

• support_level:

• shape inference:

This version of the operator has been available since version 1.

Summary

Produces a slice of the input tensor along multiple axes. Similar to numpy: https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html Slices uses axes, starts and ends inputs to specify the start and end dimension for each axis in the list of axes, it uses this information to slice the input data tensor. If a negative value is passed for any of the start or end indices, it represent number of elements before the end of that dimension. If the value passed to start or end is larger than the n (the number of elements in this dimension), it represents n. For slicing to the end of a dimension with unknown size, it is recommended to pass in INT_MAX. If axes are omitted, they are set to [0, …, ndim-1]. Example 1:

data = [

[1, 2, 3, 4], [5, 6, 7, 8],

] axes = [0, 1] starts = [1, 0] ends = [2, 3] result = [

[5, 6, 7],

]

Example 2:
data = [

[1, 2, 3, 4], [5, 6, 7, 8],

] starts = [0, 1] ends = [-1, 1000] result = [

[2, 3, 4],

]

Inputs

Between 3 and 4 inputs.

• data (heterogeneous) - T: Tensor of data to extract slices from.

• starts (heterogeneous) - Tind: 1-D tensor of starting indices of corresponding axis in axes

• ends (heterogeneous) - Tind: 1-D tensor of ending indices (exclusive) of corresponding axis in axes

• axes (optional, heterogeneous) - Tind: 1-D tensor of axes that starts and ends apply to.

Outputs

• output (heterogeneous) - T: Sliced data tensor.

Examples