Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
8284947b
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8284947b
编写于
7月 17, 2018
作者:
W
whs
提交者:
qingqing01
7月 17, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix infershape of im2sequence. (#12183)
上级
d1135906
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
12 deletion
+5
-12
paddle/fluid/operators/im2sequence_op.cc
paddle/fluid/operators/im2sequence_op.cc
+2
-10
paddle/fluid/operators/im2sequence_op.h
paddle/fluid/operators/im2sequence_op.h
+3
-2
未找到文件。
paddle/fluid/operators/im2sequence_op.cc
浏览文件 @
8284947b
...
@@ -33,22 +33,14 @@ class Im2SequenceOp : public framework::OperatorWithKernel {
...
@@ -33,22 +33,14 @@ class Im2SequenceOp : public framework::OperatorWithKernel {
PADDLE_ENFORCE_EQ
(
in_dim
.
size
(),
4
,
PADDLE_ENFORCE_EQ
(
in_dim
.
size
(),
4
,
"Input(X) format must be 4D tensor, eg., NCHW."
);
"Input(X) format must be 4D tensor, eg., NCHW."
);
int
batch_size
=
in_dim
[
0
];
int
img_channels
=
in_dim
[
1
];
int
img_channels
=
in_dim
[
1
];
int
img_height
=
in_dim
[
2
];
int
img_width
=
in_dim
[
3
];
auto
kernels
=
ctx
->
Attrs
().
Get
<
std
::
vector
<
int
>>
(
"kernels"
);
auto
kernels
=
ctx
->
Attrs
().
Get
<
std
::
vector
<
int
>>
(
"kernels"
);
auto
strides
=
ctx
->
Attrs
().
Get
<
std
::
vector
<
int
>>
(
"strides"
);
auto
strides
=
ctx
->
Attrs
().
Get
<
std
::
vector
<
int
>>
(
"strides"
);
auto
paddings
=
ctx
->
Attrs
().
Get
<
std
::
vector
<
int
>>
(
"paddings"
);
auto
paddings
=
ctx
->
Attrs
().
Get
<
std
::
vector
<
int
>>
(
"paddings"
);
int
output_height
=
Im2SeqOutputSize
(
img_height
,
kernels
[
0
],
paddings
[
0
],
ctx
->
SetOutputDim
(
"Out"
,
paddings
[
2
],
strides
[
0
]);
{
in_dim
[
0
],
img_channels
*
kernels
[
0
]
*
kernels
[
1
]});
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
浏览文件 @
8284947b
...
@@ -109,12 +109,13 @@ class Im2SequenceKernel : public framework::OpKernel<T> {
...
@@ -109,12 +109,13 @@ class Im2SequenceKernel : public framework::OpKernel<T> {
}
}
out
->
set_lod
(
lod
);
out
->
set_lod
(
lod
);
}
else
{
}
else
{
out
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
int
output_height
=
Im2SeqOutputSize
(
img_height
,
kernels
[
0
],
paddings
[
0
],
int
output_height
=
Im2SeqOutputSize
(
img_height
,
kernels
[
0
],
paddings
[
0
],
paddings
[
2
],
strides
[
0
]);
paddings
[
2
],
strides
[
0
]);
int
output_width
=
Im2SeqOutputSize
(
img_width
,
kernels
[
1
],
paddings
[
1
],
int
output_width
=
Im2SeqOutputSize
(
img_width
,
kernels
[
1
],
paddings
[
1
],
paddings
[
3
],
strides
[
1
]);
paddings
[
3
],
strides
[
1
]);
out
->
mutable_data
<
T
>
({
batch_size
*
output_height
*
output_width
,
img_channels
*
kernels
[
0
]
*
kernels
[
1
]},
ctx
.
GetPlace
());
const
std
::
vector
<
int
>
dilations
({
1
,
1
});
const
std
::
vector
<
int
>
dilations
({
1
,
1
});
auto
out_dims
=
out
->
dims
();
auto
out_dims
=
out
->
dims
();
out
->
Resize
({
batch_size
,
out
->
numel
()
/
batch_size
});
out
->
Resize
({
batch_size
,
out
->
numel
()
/
batch_size
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录