Skip to content

Commit fea8568

Browse files
askhadeebarsoum
authored andcommitted
minor changes to NonZero and Slice (#2429)
* minor changes to NonZero and Slice * more updates
1 parent 79bd504 commit fea8568

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

docs/Changelog.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8662,7 +8662,7 @@ This version of the operator has been available since version 9 of the default O
86628662

86638663
<dl>
86648664
<dt><tt>Y</tt> : tensor(int64)</dt>
8665-
<dd>output (always 2D tensor)</dd>
8665+
<dd>output</dd>
86668666
</dl>
86678667

86688668
#### Type Constraints
@@ -13398,11 +13398,13 @@ This version of the operator has been available since version 11 of the default
1339813398
Slices uses `starts`, `ends`, `axes` and `steps` inputs to specify the start and end
1339913399
dimension and step for each axis in the list of axes, it uses this information to
1340013400
slice the input `data` tensor. If a negative value is passed for any of the
13401-
start or end indices, it represent number of elements before the end of that
13401+
start or end indices, it represents number of elements before the end of that
1340213402
dimension. If the value passed to start or end is larger than the `n` (the
1340313403
number of elements in this dimension), it represents `n`. For slicing to the
13404-
end of a dimension with unknown size, it is recommended to pass in `INT_MAX`.
13405-
If a negative value is passed for step, it represents slicing backward.
13404+
end of a dimension with unknown size, it is recommended to pass in `INT_MAX`
13405+
when sclicing forward and 'INT_MIN' when slicing backward.
13406+
If a negative value is passed for step, it represents slicing backward.
13407+
However step value cannot be 0.
1340613408
If `axes` are omitted, they are set to `[0, ..., ndim-1]`.
1340713409
If `steps` are omitted, they are set to `[1, ..., 1]` of length `len(starts)`
1340813410
Example 1:
@@ -13444,7 +13446,7 @@ This version of the operator has been available since version 11 of the default
1344413446
<dt><tt>axes</tt> (optional) : Tind</dt>
1344513447
<dd>1-D tensor of axes that `starts` and `ends` apply to. Negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(data).</dd>
1344613448
<dt><tt>steps</tt> (optional) : Tind</dt>
13447-
<dd>1-D tensor of slice step of corresponding axis in `axes`. Default to 1. </dd>
13449+
<dd>1-D tensor of slice step of corresponding axis in `axes`. Negative value means slicing backward. 'steps' cannot be 0. Defaults to 1.</dd>
1344813450
</dl>
1344913451

1345013452
#### Outputs

docs/Operators.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9727,7 +9727,7 @@ This version of the operator has been available since version 9 of the default O
97279727

97289728
<dl>
97299729
<dt><tt>Y</tt> : tensor(int64)</dt>
9730-
<dd>output (always 2D tensor)</dd>
9730+
<dd>output</dd>
97319731
</dl>
97329732

97339733
#### Type Constraints
@@ -16191,11 +16191,13 @@ expect(node, inputs=[x], outputs=[y],
1619116191
Slices uses `starts`, `ends`, `axes` and `steps` inputs to specify the start and end
1619216192
dimension and step for each axis in the list of axes, it uses this information to
1619316193
slice the input `data` tensor. If a negative value is passed for any of the
16194-
start or end indices, it represent number of elements before the end of that
16194+
start or end indices, it represents number of elements before the end of that
1619516195
dimension. If the value passed to start or end is larger than the `n` (the
1619616196
number of elements in this dimension), it represents `n`. For slicing to the
16197-
end of a dimension with unknown size, it is recommended to pass in `INT_MAX`.
16198-
If a negative value is passed for step, it represents slicing backward.
16197+
end of a dimension with unknown size, it is recommended to pass in `INT_MAX`
16198+
when sclicing forward and 'INT_MIN' when slicing backward.
16199+
If a negative value is passed for step, it represents slicing backward.
16200+
However step value cannot be 0.
1619916201
If `axes` are omitted, they are set to `[0, ..., ndim-1]`.
1620016202
If `steps` are omitted, they are set to `[1, ..., 1]` of length `len(starts)`
1620116203
Example 1:
@@ -16239,7 +16241,7 @@ Other versions of this operator: <a href="Changelog.md#Slice-1">Slice-1</a>, <a
1623916241
<dt><tt>axes</tt> (optional) : Tind</dt>
1624016242
<dd>1-D tensor of axes that `starts` and `ends` apply to. Negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(data).</dd>
1624116243
<dt><tt>steps</tt> (optional) : Tind</dt>
16242-
<dd>1-D tensor of slice step of corresponding axis in `axes`. Default to 1. </dd>
16244+
<dd>1-D tensor of slice step of corresponding axis in `axes`. Negative value means slicing backward. 'steps' cannot be 0. Defaults to 1.</dd>
1624316245
</dl>
1624416246

1624516247
#### Outputs

onnx/defs/tensor/defs.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,11 +452,13 @@ Produces a slice of the input tensor along multiple axes. Similar to numpy:
452452
Slices uses `starts`, `ends`, `axes` and `steps` inputs to specify the start and end
453453
dimension and step for each axis in the list of axes, it uses this information to
454454
slice the input `data` tensor. If a negative value is passed for any of the
455-
start or end indices, it represent number of elements before the end of that
455+
start or end indices, it represents number of elements before the end of that
456456
dimension. If the value passed to start or end is larger than the `n` (the
457457
number of elements in this dimension), it represents `n`. For slicing to the
458-
end of a dimension with unknown size, it is recommended to pass in `INT_MAX`.
459-
If a negative value is passed for step, it represents slicing backward.
458+
end of a dimension with unknown size, it is recommended to pass in `INT_MAX`
459+
when sclicing forward and 'INT_MIN' when slicing backward.
460+
If a negative value is passed for step, it represents slicing backward.
461+
However step value cannot be 0.
460462
If `axes` are omitted, they are set to `[0, ..., ndim-1]`.
461463
If `steps` are omitted, they are set to `[1, ..., 1]` of length `len(starts)`
462464
Example 1:
@@ -509,7 +511,9 @@ ONNX_OPERATOR_SET_SCHEMA(
509511
.Input(
510512
4,
511513
"steps",
512-
"1-D tensor of slice step of corresponding axis in `axes`. Default to 1. ",
514+
"1-D tensor of slice step of corresponding axis in `axes`. "
515+
"Negative value means slicing backward. 'steps' cannot be 0. "
516+
"Defaults to 1.",
513517
"Tind",
514518
OpSchema::Optional)
515519
.Output(0, "output", "Sliced data tensor.", "T")
@@ -2115,7 +2119,7 @@ ONNX_OPERATOR_SET_SCHEMA(
21152119
OpSchema()
21162120
.SetDoc(NonZero_ver9_doc)
21172121
.Input(0, "X", "input", "T")
2118-
.Output(0, "Y", "output (always 2D tensor)", "tensor(int64)")
2122+
.Output(0, "Y", "output", "tensor(int64)")
21192123
.TypeConstraint(
21202124
"T",
21212125
OpSchema::all_tensor_types(),

0 commit comments

Comments
 (0)