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