Slice - 10 vs 11#

Next section compares an older to a newer version of the same operator after both definition are converted into markdown text. Green means an addition to the newer version, red means a deletion. Anything else is unchanged.

Files changed (1) hide show
  1. Slice10 → Slice11 +5 -9
Slice10 → Slice11 RENAMED
@@ -1 +1 @@
1
1
  Produces a slice of the input tensor along multiple axes. Similar to numpy:
2
2
  https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
3
3
  Slices uses starts, ends, axes and steps inputs to specify the start and end
4
4
  dimension and step for each axis in the list of axes, it uses this information to
5
5
  slice the input data tensor. If a negative value is passed for any of the
6
- start or end indices, it represents number of elements before the end of that
6
+ start or end indices, it represent number of elements before the end of that
7
7
  dimension. If the value passed to start or end is larger than the n (the
8
8
  number of elements in this dimension), it represents n. For slicing to the
9
- end of a dimension with unknown size, it is recommended to pass in INT_MAX
9
+ end of a dimension with unknown size, it is recommended to pass in INT_MAX.
10
- when slicing forward and 'INT_MIN' when slicing backward.
11
10
  If a negative value is passed for step, it represents slicing backward.
12
- However step value cannot be 0.
13
11
  If axes are omitted, they are set to [0, ..., ndim-1].
14
12
  If steps are omitted, they are set to [1, ..., 1] of length len(starts)
15
13
  Example 1:
16
14
  data = [
17
15
  [1, 2, 3, 4],
18
16
  [5, 6, 7, 8],
19
17
  ]
20
18
  axes = [0, 1]
21
19
  starts = [1, 0]
22
20
  ends = [2, 3]
23
21
  steps = [1, 2]
24
22
  result = [
25
23
  [5, 7],
26
24
  ]
27
25
  Example 2:
28
26
  data = [
29
27
  [1, 2, 3, 4],
30
28
  [5, 6, 7, 8],
31
29
  ]
32
30
  starts = [0, 1]
33
31
  ends = [-1, 1000]
34
32
  result = [
35
33
  [2, 3, 4],
36
34
  ]
37
35
  **Inputs**
38
36
  Between 3 and 5 inputs.
39
37
  * **data** (heterogeneous) - **T**:
40
38
  Tensor of data to extract slices from.
41
39
  * **starts** (heterogeneous) - **Tind**:
42
40
  1-D tensor of starting indices of corresponding axis in axes
43
41
  * **ends** (heterogeneous) - **Tind**:
44
42
  1-D tensor of ending indices (exclusive) of corresponding axis in
45
43
  axes
46
44
  * **axes** (optional, heterogeneous) - **Tind**:
47
- 1-D tensor of axes that starts and ends apply to. Negative value
45
+ 1-D tensor of axes that starts and ends apply to.
48
- means counting dimensions from the back. Accepted range is [-r, r-1]
49
- where r = rank(data).
50
46
  * **steps** (optional, heterogeneous) - **Tind**:
51
- 1-D tensor of slice step of corresponding axis in axes. Negative
47
+ 1-D tensor of slice step of corresponding axis in axes. Default to
52
- value means slicing backward. 'steps' cannot be 0. Defaults to 1.
48
+ 1.
53
49
  **Outputs**
54
50
  * **output** (heterogeneous) - **T**:
55
51
  Sliced data tensor.
56
52
  **Type Constraints**
57
53
  * **T** in (
58
54
  tensor(bool),
59
55
  tensor(complex128),
60
56
  tensor(complex64),
61
57
  tensor(double),
62
58
  tensor(float),
63
59
  tensor(float16),
64
60
  tensor(int16),
65
61
  tensor(int32),
66
62
  tensor(int64),
67
63
  tensor(int8),
68
64
  tensor(string),
69
65
  tensor(uint16),
70
66
  tensor(uint32),
71
67
  tensor(uint64),
72
68
  tensor(uint8)
73
69
  ):
74
70
  Constrain input and output types to all tensor types.
75
71
  * **Tind** in (
76
72
  tensor(int32),
77
73
  tensor(int64)
78
74
  ):
79
75
  Constrain indices to integer types