Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
6566d7c7
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
6566d7c7
编写于
2月 16, 2018
作者:
H
helinwang
提交者:
GitHub
2月 16, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8458 from tonyyang-svail/rename_output
change outputsize func name
上级
c7ad26d6
cb06337f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
26 addition
and
25 deletion
+26
-25
paddle/fluid/operators/conv_op.cc
paddle/fluid/operators/conv_op.cc
+3
-2
paddle/fluid/operators/conv_op.h
paddle/fluid/operators/conv_op.h
+2
-2
paddle/fluid/operators/im2sequence_op.cc
paddle/fluid/operators/im2sequence_op.cc
+4
-4
paddle/fluid/operators/im2sequence_op.h
paddle/fluid/operators/im2sequence_op.h
+10
-10
paddle/fluid/operators/pool_op.cc
paddle/fluid/operators/pool_op.cc
+2
-2
paddle/fluid/operators/pool_with_index_op.cc
paddle/fluid/operators/pool_with_index_op.cc
+2
-2
paddle/fluid/operators/unpool_op.cc
paddle/fluid/operators/unpool_op.cc
+3
-3
未找到文件。
paddle/fluid/operators/conv_op.cc
浏览文件 @
6566d7c7
...
...
@@ -60,8 +60,9 @@ void ConvOp::InferShape(framework::InferShapeContext* ctx) const {
"Due to the settings of paddings, filter_dims and "
"dilations, the output size is less than 0, please check "
"again."
);
output_shape
.
push_back
(
OutputSize
(
in_dims
[
i
+
2
],
filter_dims
[
i
+
2
],
dilations
[
i
],
paddings
[
i
],
strides
[
i
]));
output_shape
.
push_back
(
ConvOutputSize
(
in_dims
[
i
+
2
],
filter_dims
[
i
+
2
],
dilations
[
i
],
paddings
[
i
],
strides
[
i
]));
}
ctx
->
SetOutputDim
(
"Output"
,
framework
::
make_ddim
(
output_shape
));
ctx
->
ShareLoD
(
"Input"
,
"Output"
);
...
...
paddle/fluid/operators/conv_op.h
浏览文件 @
6566d7c7
...
...
@@ -28,8 +28,8 @@ using Tensor = framework::Tensor;
// Base convolution operator definations for other conv
// like operators to reuse the implementation.
inline
int
OutputSize
(
int
input_size
,
int
filter_size
,
int
dilation
,
int
padding
,
int
stride
)
{
inline
int
Conv
OutputSize
(
int
input_size
,
int
filter_size
,
int
dilation
,
int
padding
,
int
stride
)
{
const
int
dkernel
=
dilation
*
(
filter_size
-
1
)
+
1
;
const
int
output_size
=
(
input_size
+
2
*
padding
-
dkernel
)
/
stride
+
1
;
return
output_size
;
...
...
paddle/fluid/operators/im2sequence_op.cc
浏览文件 @
6566d7c7
...
...
@@ -41,10 +41,10 @@ class Im2SequenceOp : public framework::OperatorWithKernel {
int
img_height
=
in_dim
[
2
];
int
img_width
=
in_dim
[
3
];
int
output_height
=
OutputSize
(
img_height
,
kernels
[
0
],
paddings
[
0
],
paddings
[
2
],
strides
[
0
]);
int
output_width
=
OutputSize
(
img_width
,
kernels
[
1
],
paddings
[
1
],
paddings
[
3
],
strides
[
1
]);
int
output_height
=
Im2Seq
OutputSize
(
img_height
,
kernels
[
0
],
paddings
[
0
],
paddings
[
2
],
strides
[
0
]);
int
output_width
=
Im2SeqOutputSize
(
img_width
,
kernels
[
1
],
paddings
[
1
],
paddings
[
3
],
strides
[
1
]);
ctx
->
SetOutputDim
(
"Out"
,
{
batch_size
*
output_height
*
output_width
,
img_channels
*
kernels
[
0
]
*
kernels
[
1
]});
...
...
paddle/fluid/operators/im2sequence_op.h
浏览文件 @
6566d7c7
...
...
@@ -26,8 +26,8 @@ namespace operators {
using
Tensor
=
framework
::
Tensor
;
using
LoDTensor
=
framework
::
LoDTensor
;
inline
int
OutputSize
(
int
input_size
,
int
filter_size
,
int
padding_0
,
int
padding_1
,
int
stride
)
{
inline
int
Im2Seq
OutputSize
(
int
input_size
,
int
filter_size
,
int
padding_0
,
int
padding_1
,
int
stride
)
{
const
int
output_size
=
(
input_size
+
padding_0
+
padding_1
-
filter_size
)
/
stride
+
1
;
return
output_size
;
...
...
@@ -53,10 +53,10 @@ class Im2SequenceKernel : public framework::OpKernel<T> {
auto
kernels
=
ctx
.
Attr
<
std
::
vector
<
int
>>
(
"kernels"
);
auto
strides
=
ctx
.
Attr
<
std
::
vector
<
int
>>
(
"strides"
);
auto
paddings
=
ctx
.
Attr
<
std
::
vector
<
int
>>
(
"paddings"
);
int
output_height
=
OutputSize
(
img_height
,
kernels
[
0
],
paddings
[
0
],
paddings
[
2
],
strides
[
0
]);
int
output_width
=
OutputSize
(
img_width
,
kernels
[
1
],
paddings
[
1
],
paddings
[
3
],
strides
[
1
]);
int
output_height
=
Im2Seq
OutputSize
(
img_height
,
kernels
[
0
],
paddings
[
0
],
paddings
[
2
],
strides
[
0
]);
int
output_width
=
Im2SeqOutputSize
(
img_width
,
kernels
[
1
],
paddings
[
1
],
paddings
[
3
],
strides
[
1
]);
const
std
::
vector
<
int
>
dilations
({
1
,
1
});
...
...
@@ -109,10 +109,10 @@ class Im2SequenceGradKernel : public framework::OpKernel<T> {
auto
kernels
=
ctx
.
Attr
<
std
::
vector
<
int
>>
(
"kernels"
);
auto
strides
=
ctx
.
Attr
<
std
::
vector
<
int
>>
(
"strides"
);
auto
paddings
=
ctx
.
Attr
<
std
::
vector
<
int
>>
(
"paddings"
);
int
output_height
=
OutputSize
(
img_height
,
kernels
[
0
],
paddings
[
0
],
paddings
[
2
],
strides
[
0
]);
int
output_width
=
OutputSize
(
img_width
,
kernels
[
1
],
paddings
[
1
],
paddings
[
3
],
strides
[
1
]);
int
output_height
=
Im2Seq
OutputSize
(
img_height
,
kernels
[
0
],
paddings
[
0
],
paddings
[
2
],
strides
[
0
]);
int
output_width
=
Im2SeqOutputSize
(
img_width
,
kernels
[
1
],
paddings
[
1
],
paddings
[
3
],
strides
[
1
]);
const
std
::
vector
<
int
>
dilations
({
1
,
1
});
...
...
paddle/fluid/operators/pool_op.cc
浏览文件 @
6566d7c7
...
...
@@ -17,7 +17,7 @@ limitations under the License. */
namespace
paddle
{
namespace
operators
{
int
OutputSizePool
(
int
input_size
,
int
filter_size
,
int
padding
,
int
stride
)
{
int
PoolOutputSize
(
int
input_size
,
int
filter_size
,
int
padding
,
int
stride
)
{
int
output_size
=
(
input_size
-
filter_size
+
2
*
padding
)
/
stride
+
1
;
return
output_size
;
}
...
...
@@ -55,7 +55,7 @@ void PoolOp::InferShape(framework::InferShapeContext *ctx) const {
std
::
vector
<
int64_t
>
output_shape
({
in_x_dims
[
0
],
in_x_dims
[
1
]});
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
{
output_shape
.
push_back
(
OutputSizePool
(
in_x_dims
[
i
+
2
],
ksize
[
i
],
paddings
[
i
],
strides
[
i
]));
PoolOutputSize
(
in_x_dims
[
i
+
2
],
ksize
[
i
],
paddings
[
i
],
strides
[
i
]));
}
ctx
->
SetOutputDim
(
"Out"
,
framework
::
make_ddim
(
output_shape
));
ctx
->
ShareLoD
(
"X"
,
"Out"
);
...
...
paddle/fluid/operators/pool_with_index_op.cc
浏览文件 @
6566d7c7
...
...
@@ -17,7 +17,7 @@ limitations under the License. */
namespace
paddle
{
namespace
operators
{
inline
int
OutputSizeMaxPool
(
int
input_size
,
int
filter_size
,
int
padding
,
inline
int
MaxPoolOutputSize
(
int
input_size
,
int
filter_size
,
int
padding
,
int
stride
)
{
int
output_size
=
(
input_size
-
filter_size
+
2
*
padding
)
/
stride
+
1
;
return
output_size
;
...
...
@@ -61,7 +61,7 @@ class MaxPoolWithIndexOp : public framework::OperatorWithKernel {
std
::
vector
<
int64_t
>
output_shape
({
in_x_dims
[
0
],
in_x_dims
[
1
]});
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
{
output_shape
.
push_back
(
OutputSizeMaxPool
(
in_x_dims
[
i
+
2
],
ksize
[
i
],
output_shape
.
push_back
(
MaxPoolOutputSize
(
in_x_dims
[
i
+
2
],
ksize
[
i
],
paddings
[
i
],
strides
[
i
]));
}
ctx
->
SetOutputDim
(
"Out"
,
framework
::
make_ddim
(
output_shape
));
...
...
paddle/fluid/operators/unpool_op.cc
浏览文件 @
6566d7c7
...
...
@@ -64,7 +64,7 @@ Paper: http://www.matthewzeiler.com/wp-content/uploads/2017/07/iccv2011.pdf
}
};
int
OutputSize
(
int
input_size
,
int
ksize
,
int
padding
,
int
stride
)
{
int
Unpool
OutputSize
(
int
input_size
,
int
ksize
,
int
padding
,
int
stride
)
{
int
output_size
=
(
input_size
-
1
)
*
stride
-
2
*
padding
+
ksize
;
return
output_size
;
}
...
...
@@ -101,8 +101,8 @@ class UnpoolOp : public framework::OperatorWithKernel {
PADDLE_ENFORCE_EQ
(
in_x_dims
,
in_y_dims
);
std
::
vector
<
int64_t
>
output_shape
({
in_x_dims
[
0
],
in_x_dims
[
1
]});
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
{
output_shape
.
push_back
(
OutputSize
(
in_x_dims
[
i
+
2
],
ksize
[
i
],
paddings
[
i
],
strides
[
i
]));
output_shape
.
push_back
(
UnpoolOutputSize
(
in_x_dims
[
i
+
2
],
ksize
[
i
],
paddings
[
i
],
strides
[
i
]));
}
ctx
->
SetOutputDim
(
"Out"
,
framework
::
make_ddim
(
output_shape
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录