@@ -66,40 +66,41 @@ class ElementwiseOpMaker : public framework::OpProtoAndCheckerMaker {
66
66
.SetDefault (-1 )
67
67
.EqualGreaterThan (-1 );
68
68
AddComment (string::Sprintf (R"DOC(
69
- Limited Elementwise %s Operator.
69
+ Limited Elementwise %s Operator
70
70
71
71
The equation is:
72
72
73
73
$$%s$$
74
74
75
- $X$ is a tensor of any dimension and the dimensions of tensor $Y$ must be
76
- smaller than or equal to the dimensions of $X$.
75
+ - $X$: a tensor of any dimension.
76
+ - $Y$: a tensor whose dimensions must be less than or equal to the dimensions of $X$.
77
77
78
78
There are two cases for this operator:
79
- 1. The shape of $Y$ is same with $X$;
80
- 2. The shape of $Y$ is a congiguous subsequencet of $X$. The trailing dimensions
81
- of size 1 for $Y$ will be ignored for the consideration of subsequence.
82
79
80
+ 1. The shape of $Y$ is the same with $X$.
81
+ 2. The shape of $Y$ is a continuous subsequence of $X$.
83
82
84
83
For case 2:
85
84
86
- $Y$ will be broadcasted to match the shape of $X$ and axis should be
87
- set to index of the start dimension to broadcast $Y$ onto $X$.
85
+ 1. Broadcast $Y$ to match the shape of $X$, where $axis$ is the start dimension index
86
+ for broadcasting $Y$ onto $X$.
87
+ 2. If $axis$ is -1 (default), $axis = rank(X) - rank(Y)$.
88
+ 3. The trailing dimensions of size 1 for $Y$ will be ignored for the consideration of
89
+ subsequence, such as shape(Y) = (2, 1) => (2).
88
90
89
- If axis is -1, it is treated as axis=rank(X)-rank(Y).
91
+ For example:
90
92
91
- For example
92
93
.. code-block:: python
93
94
94
95
shape(X) = (2, 3, 4, 5), shape(Y) = (,)
95
96
shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
96
- shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5)
97
+ shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5), with axis=-1(default) or axis=2
97
98
shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
98
99
shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0
99
100
shape(X) = (2, 3, 4, 5), shape(Y) = (2, 1), with axis=0
100
101
101
- Either of the inputs $X$ and $Y$ or none can carry the LoD (Level of Details)
102
- information. However, the output only shares the LoD information with input $X$.
102
+ The inputs $X$ and $Y$ can carry the different LoD information.
103
+ But the output only shares the LoD information with the input $X$.
103
104
104
105
)DOC" ,
105
106
GetName (), GetEquation ()));
0 commit comments