Slice - 10 vs 11

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