Skip to content

Commit af760ea

Browse files
kexinzhaowangkuiyi
authored andcommitted
polish op from e to f (#5357)
1 parent c5c0243 commit af760ea

10 files changed

+66
-39
lines changed

paddle/operators/elementwise_add_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ElementwiseAddOpMaker : public ElementwiseOpMaker {
2222
ElementwiseAddOpMaker(framework::OpProto* proto,
2323
framework::OpAttrChecker* op_checker)
2424
: ElementwiseOpMaker(proto, op_checker) {
25-
SetComment("add", "Out = X + Y");
25+
SetComment("Add", "$Out = X + Y$");
2626
AddComment(comment_);
2727
}
2828
};

paddle/operators/elementwise_div_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ElementwiseDivOpMaker : public ElementwiseOpMaker {
2222
ElementwiseDivOpMaker(framework::OpProto* proto,
2323
framework::OpAttrChecker* op_checker)
2424
: ElementwiseOpMaker(proto, op_checker) {
25-
SetComment("Div", "Out = X / Y");
25+
SetComment("Div", "$Out = X / Y$");
2626
AddComment(comment_);
2727
}
2828
};

paddle/operators/elementwise_mul_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ElementwiseMulOpMaker : public ElementwiseOpMaker {
2323
ElementwiseMulOpMaker(framework::OpProto* proto,
2424
framework::OpAttrChecker* op_checker)
2525
: ElementwiseOpMaker(proto, op_checker) {
26-
SetComment("Mul", "Out = X ⊙ Y");
26+
SetComment("Mul", "$Out = X \\odot\\ Y$");
2727
AddComment(comment_);
2828
}
2929
};

paddle/operators/elementwise_op.h

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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
7882
Both 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
}

paddle/operators/elementwise_sub_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ElementwiseSubOpMaker : public ElementwiseOpMaker {
2222
ElementwiseSubOpMaker(framework::OpProto* proto,
2323
framework::OpAttrChecker* op_checker)
2424
: ElementwiseOpMaker(proto, op_checker) {
25-
SetComment("Sub", "Out = X - Y");
25+
SetComment("Sub", "$Out = X - Y$");
2626
AddComment(comment_);
2727
}
2828
};

paddle/operators/feed_op.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@ class FeedOpInfoMaker : public framework::OpProtoAndCheckerMaker {
5959
: OpProtoAndCheckerMaker(proto, op_checker) {
6060
AddInput("X", "The input of feed op");
6161
AddOutput("Out", "The output of feed op");
62-
AddComment("feed op, it should not be configured by users directly");
63-
AddAttr<int>("col", "column of feed");
62+
AddAttr<int>("col", "(int) The column of feed");
63+
AddComment(R"DOC(
64+
Feed Operator.
65+
66+
It should not be configured by users directly.
67+
68+
)DOC");
6469
}
6570
};
6671

paddle/operators/fetch_op.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@ class FetchOpInfoMaker : public framework::OpProtoAndCheckerMaker {
6666
: OpProtoAndCheckerMaker(proto, op_checker) {
6767
AddInput("X", "The input of fetch op");
6868
AddOutput("Out", "The output of fetch op");
69-
AddComment("fetch op, it should not be configured by users directly");
70-
AddAttr<int>("col", "column of fetch");
69+
AddAttr<int>("col", "(int) The column of fetch");
70+
AddComment(R"DOC(
71+
Fetch Operator.
72+
73+
It should not be configured by users directly.
74+
75+
)DOC");
7176
}
7277
};
7378
} // namespace operators

paddle/operators/fill_constant_batch_size_like_op.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,16 @@ class FillConstantBatchSizeLikeOpMaker
7070
"with the specified value");
7171
AddAttr<std::vector<int>>("shape", "(vector<int>) The shape of the output");
7272
AddAttr<int>("dim_idx",
73-
"(int, default 0) the index of batch size dimension")
73+
"(int, default 0) The index of batch size dimension")
7474
.SetDefault(0);
7575
AddAttr<float>("value", "(float, default 0) The value to be filled")
7676
.SetDefault(0.0f);
77-
AddComment(R"DOC(Fill up a variable with specified constant value.)DOC");
77+
AddComment(R"DOC(
78+
FillConstantBatchSizeLike Operator.
79+
80+
Fill up a variable with specified constant value.
81+
82+
)DOC");
7883
}
7984
};
8085
} // namespace operators

paddle/operators/fill_constant_op.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ class FillConstantOpMaker : public framework::OpProtoAndCheckerMaker {
5454
AddOutput("Out",
5555
"(Tensor) Tensor of specified shape will be filled "
5656
"with the specified value");
57-
AddComment(R"DOC(Fill up a variable with specified constant value.)DOC");
57+
AddComment(R"DOC(
58+
FillConstantBatchSizeLike Operator.
59+
60+
Fill up a variable with specified constant value.
61+
62+
)DOC");
5863
}
5964
};
6065
} // namespace operators

paddle/operators/fill_zeros_like_op.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ class FillZerosLikeOpMaker : public framework::OpProtoAndCheckerMaker {
3737
framework::OpAttrChecker *op_checker)
3838
: framework::OpProtoAndCheckerMaker(proto, op_checker) {
3939
AddInput("X", "The input of fill-zeros-like op.");
40-
AddOutput("Y", "The varibale will be filled up with zeros.");
40+
AddOutput("Y", "The variable will be filled up with zeros.");
4141
AddComment(R"DOC(
42-
Fill up a vriable with zeros.
42+
FillZerosLike Operator.
43+
44+
Fill up a variable with zeros.
45+
The output will have the same size as the input.
4346
44-
The output will have the same size with input.
4547
)DOC");
4648
}
4749
};

0 commit comments

Comments
 (0)