Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
779ffb84
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看板
未验证
提交
779ffb84
编写于
4月 16, 2019
作者:
H
Hongyu Liu
提交者:
GitHub
4月 16, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16876 from tink2123/infer_shape
modified infer shape for op
上级
69bdcfa6
e0f7bf4f
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
31 addition
and
12 deletion
+31
-12
paddle/fluid/operators/affine_channel_op.cc
paddle/fluid/operators/affine_channel_op.cc
+6
-2
paddle/fluid/operators/conv_op.cc
paddle/fluid/operators/conv_op.cc
+8
-3
paddle/fluid/operators/detection_map_op.cc
paddle/fluid/operators/detection_map_op.cc
+4
-2
paddle/fluid/operators/row_conv_op.cc
paddle/fluid/operators/row_conv_op.cc
+6
-3
paddle/fluid/operators/unpool_op.cc
paddle/fluid/operators/unpool_op.cc
+7
-2
未找到文件。
paddle/fluid/operators/affine_channel_op.cc
浏览文件 @
779ffb84
...
...
@@ -79,9 +79,13 @@ class AffineChannelOp : public framework::OperatorWithKernel {
:
x_dims
[
x_dims
.
size
()
-
1
]);
PADDLE_ENFORCE_EQ
(
scale_dims
.
size
(),
1UL
);
PADDLE_ENFORCE_EQ
(
scale_dims
[
0
],
C
);
PADDLE_ENFORCE_EQ
(
b_dims
.
size
(),
1UL
);
if
(
ctx
->
IsRuntime
()
||
scale_dims
[
0
]
>
0
)
{
PADDLE_ENFORCE_EQ
(
scale_dims
[
0
],
C
);
}
if
(
ctx
->
IsRuntime
()
||
b_dims
[
0
]
>
0
)
{
PADDLE_ENFORCE_EQ
(
b_dims
[
0
],
C
);
}
ctx
->
SetOutputDim
(
"Out"
,
ctx
->
GetInputDim
(
"X"
));
ctx
->
ShareLoD
(
"X"
,
"Out"
);
...
...
paddle/fluid/operators/conv_op.cc
浏览文件 @
779ffb84
...
...
@@ -68,10 +68,15 @@ void ConvOp::InferShape(framework::InferShapeContext* ctx) const {
std
::
vector
<
int64_t
>
output_shape
({
in_dims
[
0
],
filter_dims
[
0
]});
for
(
size_t
i
=
0
;
i
<
strides
.
size
();
++
i
)
{
if
((
!
ctx
->
IsRuntime
())
&&
(
in_dims
[
i
+
2
]
<=
0
||
filter_dims
[
i
+
2
]
<=
0
))
{
output_shape
.
push_back
(
-
1
);
}
else
{
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/detection_map_op.cc
浏览文件 @
779ffb84
...
...
@@ -51,8 +51,10 @@ class DetectionMAPOp : public framework::OperatorWithKernel {
PADDLE_ENFORCE_EQ
(
label_dims
.
size
(),
2
,
"The rank of Input(Label) must be 2, "
"the shape is [N, 6]."
);
if
(
ctx
->
IsRuntime
()
||
label_dims
[
1
]
>
0
)
{
PADDLE_ENFORCE
(
label_dims
[
1
]
==
6
||
label_dims
[
1
]
==
5
,
"The shape of Input(Label) is [N, 6] or [N, 5]."
);
}
if
(
ctx
->
HasInput
(
"PosCount"
))
{
PADDLE_ENFORCE
(
ctx
->
HasInput
(
"TruePos"
),
...
...
paddle/fluid/operators/row_conv_op.cc
浏览文件 @
779ffb84
...
...
@@ -45,9 +45,12 @@ class RowConvOp : public framework::OperatorWithKernel {
auto
filter_dims
=
ctx
->
GetInputDim
(
"Filter"
);
PADDLE_ENFORCE_EQ
(
x_dims
.
size
(),
2
,
"Input(X)'s rank should be 2."
);
PADDLE_ENFORCE_EQ
(
filter_dims
.
size
(),
2
,
"Input(Y)'s rank should be 2."
);
if
(
ctx
->
IsRuntime
()
||
(
x_dims
[
1
]
>
0
&&
filter_dims
[
1
]
>
0
))
{
PADDLE_ENFORCE_EQ
(
x_dims
[
1
],
filter_dims
[
1
],
"The 2nd dimension of Input(X) and Input(Filter) should be same."
);
}
ctx
->
SetOutputDim
(
"Out"
,
x_dims
);
ctx
->
ShareLoD
(
"X"
,
"Out"
);
}
...
...
paddle/fluid/operators/unpool_op.cc
浏览文件 @
779ffb84
...
...
@@ -99,11 +99,16 @@ class UnpoolOp : public framework::OperatorWithKernel {
PADDLE_ENFORCE
(
in_x_dims
.
size
()
==
4
,
"Unpooling intput must be of 4-dimensional."
);
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
)
{
if
(
!
ctx
->
IsRuntime
()
&&
in_x_dims
[
i
+
2
]
<=
0
)
{
output_shape
.
push_back
(
-
1
);
}
else
{
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录