Skip to content

Commit ce33262

Browse files
BowenBaospandantiwari
authored andcommitted
Update Slice with dynamic input & optional input steps (#1836)
* Update Slice with dynamic input & input steps
1 parent 3a9a878 commit ce33262

File tree

58 files changed

+747
-750
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+747
-750
lines changed

docs/Changelog.md

Lines changed: 72 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -846,72 +846,6 @@ This version of the operator has been available since version 1 of the default O
846846
<dd>Constrain input and output types to float tensors.</dd>
847847
</dl>
848848

849-
### <a name="DynamicSlice-1"></a>**DynamicSlice-1**</a>
850-
851-
Produces a slice of the input tensor along multiple axes. Similar to numpy:
852-
https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
853-
Slices uses `axes`, `starts` and `ends` inputs to specify the start and end
854-
dimension for each axis in the list of axes, it uses this information to
855-
slice the input `data` tensor. If a negative value is passed for any of the
856-
start or end indices, it represent number of elements before the end of that
857-
dimension. If the value passed to start or end is larger than the `n` (the
858-
number of elements in this dimension), it represents `n`. For slicing to the
859-
end of a dimension with unknown size, it is recommended to pass in `INT_MAX`.
860-
If `axes` are omitted, they are set to `[0, ..., ndim-1]`.
861-
Example 1:
862-
data = [
863-
[1, 2, 3, 4],
864-
[5, 6, 7, 8],
865-
]
866-
axes = [0, 1]
867-
starts = [1, 0]
868-
ends = [2, 3]
869-
result = [
870-
[5, 6, 7],
871-
]
872-
Example 2:
873-
data = [
874-
[1, 2, 3, 4],
875-
[5, 6, 7, 8],
876-
]
877-
starts = [0, 1]
878-
ends = [-1, 1000]
879-
result = [
880-
[2, 3, 4],
881-
]
882-
883-
#### Version
884-
885-
No versioning maintained for experimental ops.
886-
#### Inputs (3 - 4)
887-
888-
<dl>
889-
<dt><tt>data</tt> : T</dt>
890-
<dd>Tensor of data to extract slices from.</dd>
891-
<dt><tt>starts</tt> : Tind</dt>
892-
<dd>1-D tensor of starting indices of corresponding axis in `axes`</dd>
893-
<dt><tt>ends</tt> : Tind</dt>
894-
<dd>1-D tensor of ending indices (exclusive) of corresponding axis in axes</dd>
895-
<dt><tt>axes</tt> (optional) : Tind</dt>
896-
<dd>1-D tensor of axes that `starts` and `ends` apply to.</dd>
897-
</dl>
898-
899-
#### Outputs
900-
901-
<dl>
902-
<dt><tt>output</tt> : T</dt>
903-
<dd>Sliced data tensor.</dd>
904-
</dl>
905-
906-
#### Type Constraints
907-
908-
<dl>
909-
<dt><tt>T</tt> : tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(float16), tensor(float), tensor(double), tensor(string), tensor(bool), tensor(complex64), tensor(complex128)</dt>
910-
<dd>Constrain input and output types to all tensor types.</dd>
911-
<dt><tt>Tind</tt> : tensor(int32), tensor(int64)</dt>
912-
<dd>Constrain indices to integer types</dd>
913-
</dl>
914-
915849
### <a name="Elu-1"></a>**Elu-1**</a>
916850

917851
Elu takes one input data (Tensor<T>) and produces one output data
@@ -9554,6 +9488,78 @@ This version of the operator has been available since version 9 of the default O
95549488
</dl>
95559489

95569490
## Version 10 of the default ONNX operator set
9491+
### <a name="Slice-10"></a>**Slice-10**</a>
9492+
9493+
Produces a slice of the input tensor along multiple axes. Similar to numpy:
9494+
https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
9495+
Slices uses `starts`, `ends`, `axes` and `steps` inputs to specify the start and end
9496+
dimension and step for each axis in the list of axes, it uses this information to
9497+
slice the input `data` tensor. If a negative value is passed for any of the
9498+
start or end indices, it represent number of elements before the end of that
9499+
dimension. If the value passed to start or end is larger than the `n` (the
9500+
number of elements in this dimension), it represents `n`. For slicing to the
9501+
end of a dimension with unknown size, it is recommended to pass in `INT_MAX`.
9502+
If a negative value is passed for step, it represents slicing backward.
9503+
If `axes` are omitted, they are set to `[0, ..., ndim-1]`.
9504+
If `steps` are omitted, they are set to `[1, ..., 1]` of length `len(starts)`
9505+
Example 1:
9506+
data = [
9507+
[1, 2, 3, 4],
9508+
[5, 6, 7, 8],
9509+
]
9510+
axes = [0, 1]
9511+
starts = [1, 0]
9512+
ends = [2, 3]
9513+
steps = [1, 2]
9514+
result = [
9515+
[5, 7],
9516+
]
9517+
Example 2:
9518+
data = [
9519+
[1, 2, 3, 4],
9520+
[5, 6, 7, 8],
9521+
]
9522+
starts = [0, 1]
9523+
ends = [-1, 1000]
9524+
result = [
9525+
[2, 3, 4],
9526+
]
9527+
9528+
#### Version
9529+
9530+
This version of the operator has been available since version 10 of the default ONNX operator set.
9531+
9532+
#### Inputs (3 - 5)
9533+
9534+
<dl>
9535+
<dt><tt>data</tt> : T</dt>
9536+
<dd>Tensor of data to extract slices from.</dd>
9537+
<dt><tt>starts</tt> : Tind</dt>
9538+
<dd>1-D tensor of starting indices of corresponding axis in `axes`</dd>
9539+
<dt><tt>ends</tt> : Tind</dt>
9540+
<dd>1-D tensor of ending indices (exclusive) of corresponding axis in `axes`</dd>
9541+
<dt><tt>axes</tt> (optional) : Tind</dt>
9542+
<dd>1-D tensor of axes that `starts` and `ends` apply to.</dd>
9543+
<dt><tt>steps</tt> (optional) : Tind</dt>
9544+
<dd>1-D tensor of slice step of corresponding axis in `axes`. Default to 1. </dd>
9545+
</dl>
9546+
9547+
#### Outputs
9548+
9549+
<dl>
9550+
<dt><tt>output</tt> : T</dt>
9551+
<dd>Sliced data tensor.</dd>
9552+
</dl>
9553+
9554+
#### Type Constraints
9555+
9556+
<dl>
9557+
<dt><tt>T</tt> : tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(float16), tensor(float), tensor(double), tensor(string), tensor(bool), tensor(complex64), tensor(complex128)</dt>
9558+
<dd>Constrain input and output types to all tensor types.</dd>
9559+
<dt><tt>Tind</tt> : tensor(int32), tensor(int64)</dt>
9560+
<dd>Constrain indices to integer types</dd>
9561+
</dl>
9562+
95579563
### <a name="StringNormalizer-10"></a>**StringNormalizer-10**</a>
95589564

95599565
StringNormalization performs string operations for basic cleaning.

0 commit comments

Comments
 (0)