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