Slice - 1 vs 10

Files changed (1) hide show
  1. Slice1 → Slice10 +23 -14
Slice1 → Slice10 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
- Slices uses axes, starts and ends attributes to specify the start and end
3
+ Slices uses starts, ends, axes and steps inputs to specify the start and end
4
- dimension for each axis in the list of axes, it uses this information to
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
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
9
  end of a dimension with unknown size, it is recommended to pass in INT_MAX.
10
+ If a negative value is passed for step, it represents slicing backward.
10
11
  If axes are omitted, they are set to [0, ..., ndim-1].
12
+ If steps are omitted, they are set to [1, ..., 1] of length len(starts)
11
13
  Example 1:
12
14
  data = [
13
15
  [1, 2, 3, 4],
14
16
  [5, 6, 7, 8],
15
17
  ]
16
18
  axes = [0, 1]
17
19
  starts = [1, 0]
18
20
  ends = [2, 3]
21
+ steps = [1, 2]
19
22
  result = [
20
- [5, 6, 7],
23
+ [5, 7],
21
24
  ]
22
25
  Example 2:
23
26
  data = [
24
27
  [1, 2, 3, 4],
25
28
  [5, 6, 7, 8],
26
29
  ]
27
30
  starts = [0, 1]
28
31
  ends = [-1, 1000]
29
32
  result = [
30
33
  [2, 3, 4],
31
34
  ]
32
- **Attributes**
35
+ **Inputs**
36
+ Between 3 and 5 inputs.
33
- * **axes**:
34
- Axes that starts and ends apply to. It's optional. If not
35
- present, will be treated as [0, 1, ..., len(starts) - 1].
36
- * **ends** (required):
37
- Ending indices (exclusive) of corresponding axis in axes
38
- * **starts** (required):
39
- Starting indices of corresponding axis in axes
40
-
41
- **Inputs**
42
37
  * **data** (heterogeneous) - **T**:
43
38
  Tensor of data to extract slices from.
39
+ * **starts** (heterogeneous) - **Tind**:
40
+ 1-D tensor of starting indices of corresponding axis in axes
41
+ * **ends** (heterogeneous) - **Tind**:
42
+ 1-D tensor of ending indices (exclusive) of corresponding axis in
43
+ axes
44
+ * **axes** (optional, heterogeneous) - **Tind**:
45
+ 1-D tensor of axes that starts and ends apply to.
46
+ * **steps** (optional, heterogeneous) - **Tind**:
47
+ 1-D tensor of slice step of corresponding axis in axes. Default to
48
+ 1.
44
49
  **Outputs**
45
50
  * **output** (heterogeneous) - **T**:
46
51
  Sliced data tensor.
47
52
  **Type Constraints**
48
53
  * **T** in (
49
54
  tensor(bool),
50
55
  tensor(complex128),
51
56
  tensor(complex64),
52
57
  tensor(double),
53
58
  tensor(float),
54
59
  tensor(float16),
55
60
  tensor(int16),
56
61
  tensor(int32),
57
62
  tensor(int64),
58
63
  tensor(int8),
59
64
  tensor(string),
60
65
  tensor(uint16),
61
66
  tensor(uint32),
62
67
  tensor(uint64),
63
68
  tensor(uint8)
64
69
  ):
70
+ * **Tind** in (
71
+ tensor(int32),
72
+ tensor(int64)
73
+ ):
65
- Constrain input and output types to all tensor types.+ Constrain input and output types to all tensor types.
74
+ Constrain indices to integer types