ScatterElements - 11 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.

ScatterElements11 → 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
-
8
7
  For each entry in updates, the target index in data is obtained by combining
9
8
  the corresponding entry in indices with the index of the entry itself: the
10
9
  index-value for dimension = axis is obtained from the value of the corresponding
11
10
  entry in indices and the index-value for dimension != axis is obtained from the
12
11
  index of the entry itself.
13
-
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,
14
- For instance, in a 2-D tensor case, the update corresponding to the [i][j] entry
15
+ then indices[idx1] != indices[idx2]. For instance, in a 2-D tensor case, the update
15
- is performed as below:
16
+ corresponding to the [i][j] entry is performed as below:
16
17
  output[indices[i][j]][j] = updates[i][j] if axis = 0,
17
18
  output[i][indices[i][j]] = updates[i][j] if axis = 1,
19
+ When reduction is set to "add", the update corresponding to the [i][j] entry is performed as below:
20
+
21
+ output[indices[i][j]][j] += updates[i][j] if axis = 0,
22
+ output[i][indices[i][j]] += updates[i][j] if axis = 1,
23
+
24
+ When reduction is set to "mul", the update corresponding to the [i][j] entry is performed as below:
25
+
26
+ output[indices[i][j]][j] *= updates[i][j] if axis = 0,
27
+ output[i][indices[i][j]] *= updates[i][j] if axis = 1,
18
28
  This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation.
19
-
20
29
  Example 1:
21
30
  data = [
22
31
  [0.0, 0.0, 0.0],
23
32
  [0.0, 0.0, 0.0],
24
33
  [0.0, 0.0, 0.0],
25
34
  ]
26
35
  indices = [
27
36
  [1, 0, 2],
28
37
  [0, 2, 1],
29
38
  ]
30
39
  updates = [
31
40
  [1.0, 1.1, 1.2],
32
41
  [2.0, 2.1, 2.2],
33
42
  ]
34
43
  output = [
35
44
  [2.0, 1.1, 0.0]
36
45
  [1.0, 0.0, 2.2]
37
46
  [0.0, 2.1, 1.2]
38
47
  ]
39
48
  Example 2:
40
49
  data = [[1.0, 2.0, 3.0, 4.0, 5.0]]
41
50
  indices = [[1, 3]]
42
51
  updates = [[1.1, 2.1]]
43
52
  axis = 1
44
53
  output = [[1.0, 1.1, 3.0, 2.1, 5.0]]
45
54
  ### Attributes
46
55
  * **axis - INT** (default is '0'):
47
56
  Which axis to scatter on. Negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(data).
57
+ * **reduction - STRING** (default is 'none'):
58
+
59
+ Type of reduction to apply: none (default), add, mul. 'none': no reduction applied. 'add': reduction using the addition operation. 'mul': reduction using the multiplication operation.
60
+
48
61
  ### Inputs
49
62
  - **data** (heterogeneous) - **T**:
50
63
  Tensor of rank r >= 1.
51
64
  - **indices** (heterogeneous) - **Tind**:
52
65
  Tensor of int32/int64 indices, of r >= 1 (same rank as input). All index values are expected to be within bounds [-s, s-1] along axis of size s. It is an error if any of the index values are out of bounds.
53
66
  - **updates** (heterogeneous) - **T**:
54
67
  Tensor of rank r >=1 (same rank and shape as indices)
55
68
  ### Outputs
56
69
  - **output** (heterogeneous) - **T**:
57
70
  Tensor of rank r >= 1 (same rank as input).
58
71
  ### Type Constraints
59
- * **T** in ( tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ):
72
+ * **T** in ( tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ):
60
73
  Input and output types can be of any tensor type.
61
74
  * **Tind** in ( tensor(int32), tensor(int64) ):
62
75
  Constrain indices to integer types