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