Gather - 1 vs 11

Files changed (1) hide show
  1. Gather1 → Gather11 +18 -5
Gather1 → Gather11 RENAMED
@@ -1 +1 @@
1
1
  Given data tensor of rank r >= 1, and indices tensor of rank q, gather
2
2
  entries of the axis dimension of data (by default outer-most one as axis=0) indexed by indices, and concatenates
3
3
  them in an output tensor of rank q + (r - 1).
4
+
4
- Example 1:
5
+ axis = 0 :
6
+
7
+ Let
8
+ k = indices[i_{0}, ..., i_{q-1}]
9
+ Then
10
+ output[i_{0}, ..., i_{q-1}, j_{0}, ..., j_{r-2}] = input[k , j_{0}, ..., j_{r-2}]
11
+
5
12
  ::
6
13
  data = [
7
14
  [1.0, 1.2],
8
15
  [2.3, 3.4],
9
16
  [4.5, 5.7],
10
17
  ]
11
18
  indices = [
12
19
  [0, 1],
13
20
  [1, 2],
14
21
  ]
15
22
  output = [
16
23
  [
17
24
  [1.0, 1.2],
18
25
  [2.3, 3.4],
19
26
  ],
20
27
  [
21
28
  [2.3, 3.4],
22
29
  [4.5, 5.7],
23
30
  ],
24
31
  ]
25
- Example 2:
32
+ axis = 1 :
33
+
34
+ Let
35
+ k = indices[i_{0}, ..., i_{q-1}]
36
+ Then
37
+ output[i_{0}, ..., i_{q-1}, j_{0}, ..., j_{r-2}] = input[j_{0}, k, j_{1}, ..., j_{r-2}]
38
+
26
39
  ::
27
40
  data = [
28
41
  [1.0, 1.2, 1.9],
29
42
  [2.3, 3.4, 3.9],
30
43
  [4.5, 5.7, 5.9],
31
44
  ]
32
45
  indices = [
33
46
  [0, 2],
34
47
  ]
35
48
  axis = 1,
36
49
  output = [
37
50
  [
38
51
  [1.0, 1.9],
39
52
  [2.3, 3.9],
40
53
  [4.5, 5.9],
41
54
  ],
42
55
  ]
43
56
  **Attributes**
44
57
  * **axis**:
45
58
  Which axis to gather on. Negative value means counting dimensions
46
- from the back. Accepted range is [-r, r-1]
59
+ from the back. Accepted range is [-r, r-1] where r = rank(data).
47
60
  **Inputs**
48
61
  * **data** (heterogeneous) - **T**:
49
62
  Tensor of rank r >= 1.
50
63
  * **indices** (heterogeneous) - **Tind**:
51
64
  Tensor of int32/int64 indices, of any rank q. All index values are
52
- expected to be within bounds. It is an error if any of the index
65
+ expected to be within bounds [-s, s-1] along axis of size s. It is
53
- values are out of bounds.
66
+ an error if any of the index values are out of bounds.
54
67
  **Outputs**
55
68
  * **output** (heterogeneous) - **T**:
56
69
  Tensor of rank q + (r - 1).
57
70
  **Type Constraints**
58
71
  * **T** in (
59
72
  tensor(bool),
60
73
  tensor(complex128),
61
74
  tensor(complex64),
62
75
  tensor(double),
63
76
  tensor(float),
64
77
  tensor(float16),
65
78
  tensor(int16),
66
79
  tensor(int32),
67
80
  tensor(int64),
68
81
  tensor(int8),
69
82
  tensor(string),
70
83
  tensor(uint16),
71
84
  tensor(uint32),
72
85
  tensor(uint64),
73
86
  tensor(uint8)
74
87
  ):
75
88
  Constrain input and output types to any tensor type.
76
89
  * **Tind** in (
77
90
  tensor(int32),
78
91
  tensor(int64)
79
92
  ):
80
93
  Constrain indices to integer types