ScatterElements - 13 vs 16#

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.

ScatterElements13 → ScatterElements16 RENAMED
@@ -1 +1 @@
1
1
  ScatterElements takes three inputs data, updates, and indices of the same
2
2
  rank r >= 1 and an optional attribute axis that identifies an axis of data
3
3
  (by default, the outer-most axis, that is axis 0). The output of the operation
4
4
  is produced by creating a copy of the input data, and then updating its value
5
5
  to values specified by updates at specific index positions specified by
6
6
  indices. Its output shape is the same as the shape of data.
7
+
7
8
  For each entry in updates, the target index in data is obtained by combining
8
9
  the corresponding entry in indices with the index of the entry itself: the
9
10
  index-value for dimension = axis is obtained from the value of the corresponding
10
11
  entry in indices and the index-value for dimension != axis is obtained from the
11
12
  index of the entry itself.
13
+
14
+ For instance, in a 2-D tensor case, the update corresponding to the [i][j] entry
15
+ is performed as below:
12
- reduction allows specification of an optional reduction operation, which is applied to all values in updates
13
- tensor into output at the specified indices.
14
- In cases where reduction is set to "none", indices should not have duplicate entries: that is, if idx1 != idx2,
15
- then indices[idx1] != indices[idx2]. For instance, in a 2-D tensor case, the update
16
- corresponding to the [i][j] entry is performed as below:
17
16
  ::
18
17
  output[indices[i][j]][j] = updates[i][j] if axis = 0,
19
18
  output[i][indices[i][j]] = updates[i][j] if axis = 1,
19
+ This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation.
20
- When reduction is set to "add", the update corresponding to the [i][j] entry is performed as below:
21
- ::
22
- output[indices[i][j]][j] += updates[i][j] if axis = 0,
23
- output[i][indices[i][j]] += updates[i][j] if axis = 1,
24
-
25
- When reduction is set to "mul", the update corresponding to the [i][j] entry is performed as below:
26
- ::
27
-
28
- output[indices[i][j]][j] *= updates[i][j] if axis = 0,
29
- output[i][indices[i][j]] *= updates[i][j] if axis = 1,
30
-
31
- This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation.
32
20
  Example 1:
33
21
  ::
34
22
  data = [
35
23
  [0.0, 0.0, 0.0],
36
24
  [0.0, 0.0, 0.0],
37
25
  [0.0, 0.0, 0.0],
38
26
  ]
39
27
  indices = [
40
28
  [1, 0, 2],
41
29
  [0, 2, 1],
42
30
  ]
43
31
  updates = [
44
32
  [1.0, 1.1, 1.2],
45
33
  [2.0, 2.1, 2.2],
46
34
  ]
47
35
  output = [
48
36
  [2.0, 1.1, 0.0]
49
37
  [1.0, 0.0, 2.2]
50
38
  [0.0, 2.1, 1.2]
51
39
  ]
52
40
  Example 2:
53
41
  ::
54
42
  data = [[1.0, 2.0, 3.0, 4.0, 5.0]]
55
43
  indices = [[1, 3]]
56
44
  updates = [[1.1, 2.1]]
57
45
  axis = 1
58
46
  output = [[1.0, 1.1, 3.0, 2.1, 5.0]]
59
47
  **Attributes**
60
48
  * **axis**:
61
49
  Which axis to scatter on. Negative value means counting dimensions
62
50
  from the back. Accepted range is [-r, r-1] where r = rank(data).
63
- * **reduction**:
64
- Type of reduction to apply: none (default), add, mul. 'none': no
65
- reduction applied. 'add': reduction using the addition operation.
66
- 'mul': reduction using the multiplication operation.
67
51
  **Inputs**
68
52
  * **data** (heterogeneous) - **T**:
69
53
  Tensor of rank r >= 1.
70
54
  * **indices** (heterogeneous) - **Tind**:
71
55
  Tensor of int32/int64 indices, of r >= 1 (same rank as input). All
72
56
  index values are expected to be within bounds [-s, s-1] along axis
73
57
  of size s. It is an error if any of the index values are out of
74
58
  bounds.
75
59
  * **updates** (heterogeneous) - **T**:
76
60
  Tensor of rank r >=1 (same rank and shape as indices)
77
61
  **Outputs**
78
62
  * **output** (heterogeneous) - **T**:
79
63
  Tensor of rank r >= 1 (same rank as input).
80
64
  **Type Constraints**
81
65
  * **T** in (
82
66
  tensor(bfloat16),
83
67
  tensor(bool),
84
68
  tensor(complex128),
85
69
  tensor(complex64),
86
70
  tensor(double),
87
71
  tensor(float),
88
72
  tensor(float16),
89
73
  tensor(int16),
90
74
  tensor(int32),
91
75
  tensor(int64),
92
76
  tensor(int8),
93
77
  tensor(string),
94
78
  tensor(uint16),
95
79
  tensor(uint32),
96
80
  tensor(uint64),
97
81
  tensor(uint8)
98
82
  ):
99
83
  Input and output types can be of any tensor type.
100
84
  * **Tind** in (
101
85
  tensor(int32),
102
86
  tensor(int64)
103
87
  ):
104
88
  Constrain indices to integer types