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