提交 d960cbdc 编写于 作者: W wanghaoshuang

Fix comment

上级 d79e3e4d
...@@ -27,9 +27,9 @@ class PadOp : public framework::OperatorWithKernel { ...@@ -27,9 +27,9 @@ class PadOp : public framework::OperatorWithKernel {
void InferShape(const framework::InferShapeContext &ctx) const override { void InferShape(const framework::InferShapeContext &ctx) const override {
auto dim0 = ctx.Input<Tensor>("X")->dims(); auto dim0 = ctx.Input<Tensor>("X")->dims();
auto paddings = GetAttr<std::vector<int>>("paddings"); auto paddings = GetAttr<std::vector<int>>("paddings");
PADDLE_ENFORCE_EQ( PADDLE_ENFORCE_EQ(dim0.size(), (int)(paddings.size() / 2),
dim0.size(), (int)(paddings.size() / 2), "Size of paddings should be equal to 2 * dimension size "
"Paddings size should be equal to dimension size of input tensor."); "of input tensor.");
std::vector<int> dim1(dim0.size()); std::vector<int> dim1(dim0.size());
for (int i = 0; i < dim0.size(); ++i) { for (int i = 0; i < dim0.size(); ++i) {
dim1[i] = dim0[i] + paddings[i * 2] + paddings[i * 2 + 1]; dim1[i] = dim0[i] + paddings[i * 2] + paddings[i * 2 + 1];
...@@ -54,7 +54,7 @@ X = [[1, 2], ...@@ -54,7 +54,7 @@ X = [[1, 2],
and and
paddings = [(0,1),(1,2)] paddings = [0, 1, 1, 2]
and and
...@@ -68,11 +68,11 @@ Out = [[0, 1, 2, 0, 0] ...@@ -68,11 +68,11 @@ Out = [[0, 1, 2, 0, 0]
)DOC"); )DOC");
AddAttr<std::vector<int>>( AddAttr<std::vector<int>>(
"paddings", "paddings",
"A pair list to describes padding rules for each dimension." "A list<int> to describes padding rules for each dimension."
" For 2-D image tensor, paddings=[(0, 1), (2, 3)] means" " For 2-D image tensor, paddings=[0, 1, 2, 3] means"
" padding 0 row to top, 1 row to bottom, 2 columns to left" " padding 0 row to top, 1 row to bottom, 2 columns to left"
" and 3 columns to right.Paddings size should be equal to" " and 3 columns to right.Size of paddings should be equal to"
" dimension size of input tensor."); " 2 * dimension size of input tensor.");
AddAttr<float>("pad_value", AddAttr<float>("pad_value",
"(float) default to 0; " "(float) default to 0; "
"The value to be padded into tensor. ") "The value to be padded into tensor. ")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册