@@ -46,37 +46,42 @@ class ElementwiseOpMaker : public framework::OpProtoAndCheckerMaker {
4646 ElementwiseOpMaker (framework::OpProto* proto,
4747 framework::OpAttrChecker* op_checker)
4848 : OpProtoAndCheckerMaker(proto, op_checker) {
49- AddInput (" X" , R"DOC(
50- The first input of elementwise op, it's a tensor of any dimensions.
51- )DOC" );
52- AddInput (" Y" , R"DOC(
53- The sencond input of elementwise op, it's a tensor and it's dimensions
54- must be small or equal to X's dimensions.
55- )DOC" );
49+ AddInput (" X" , " (Tensor) The first input tensor of elementwise op" );
50+ AddInput (" Y" , " (Tensor) The second input tensor of elementwise op" );
51+ AddOutput (" Out" , " The output of elementwise op" );
5652 AddAttr<int >(" axis" ,
57- R"DOC(
58- When the shape(Y) does not equal the shape(X),Y will be broadcasted
59- to match the shape of X and axis should be dimension index Y in X
60- )DOC" )
53+ " (int, default -1) The starting dimension index "
54+ " for broadcasting Y onto X" )
6155 .SetDefault (-1 )
6256 .EqualGreaterThan (-1 );
63-
64- AddOutput (" Out" , " The output of elementwise op" );
6557 comment_ = R"DOC(
66- Limited elementwise {name} operator.The equation is: Out = {equation}.
67- 1. The shape of Y should be same with X or
68- 2. Y's shape is a subset of X.
69- Y will be broadcasted to match the shape of X and axis should be dimension index Y in X.
70-
71- example:
72- shape(X) = (2, 3, 4, 5), shape(Y) = (,)
73- shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
74- shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5)
75- shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
76- shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0
58+ Limited Elementwise {name} Operator.
59+
60+ The equation is:
61+
62+ {equation}
63+
64+ X is a tensor of any dimension and the dimensions of tensor Y must be smaller than
65+ or equal to the dimensions of X.
66+
67+ There are two cases for this operator:
68+ 1. The shape of Y is same with X;
69+ 2. The shape of Y is a subset of X.
70+
71+ For case 2:
72+ Y will be broadcasted to match the shape of X and axis should be
73+ the starting dimension index for broadcasting Y onto X.
74+
75+ example:
76+ shape(X) = (2, 3, 4, 5), shape(Y) = (,)
77+ shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
78+ shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5)
79+ shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
80+ shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0
7781
7882Both the input X and Y can carry the LoD (Level of Details) information,
79- or not. But the output only shares the LoD with input X.
83+ or not. But the output only shares the LoD information with input X.
84+
8085)DOC" ;
8186 AddComment (comment_);
8287 }
0 commit comments