Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
f90c06bc
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看板
未验证
提交
f90c06bc
编写于
11月 29, 2017
作者:
W
whs
提交者:
GitHub
11月 29, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5888 from wanghaoshuang/fix_crop
Add size, height and width for crop layer and switch order layer.
上级
728e8b17
a88d98c4
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
29 addition
and
0 deletion
+29
-0
python/paddle/trainer/config_parser.py
python/paddle/trainer/config_parser.py
+28
-0
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+1
-0
未找到文件。
python/paddle/trainer/config_parser.py
浏览文件 @
f90c06bc
...
...
@@ -2400,6 +2400,14 @@ class CropLayer(LayerBase):
image_conf
.
img_size_y
=
input_layer
.
height
image_conf
.
channels
=
input_layer
.
size
/
(
input_layer
.
width
*
input_layer
.
height
)
# only support for 4-dims inputs and NCHW order
if
(
len
(
self
.
config
.
inputs
)
==
2
):
self
.
set_layer_height_width
(
self
.
get_input_layer
(
1
).
height
,
self
.
get_input_layer
(
1
).
width
)
self
.
set_layer_size
(
self
.
get_input_layer
(
1
).
size
)
else
:
self
.
set_layer_height_width
(
shape
[
-
2
],
shape
[
-
1
])
self
.
set_layer_size
(
reduce
(
lambda
x
,
y
:
x
*
y
,
shape
[
1
:]))
@
config_layer
(
'batch_norm'
)
...
...
@@ -3849,6 +3857,26 @@ class SwitchOrderLayer(LayerBase):
name
,
'switch_order'
,
0
,
inputs
=
inputs
,
**
xargs
)
self
.
config
.
reshape_conf
.
height_axis
.
extend
(
reshape
[
'height'
])
self
.
config
.
reshape_conf
.
width_axis
.
extend
(
reshape
[
'width'
])
input_layer
=
self
.
get_input_layer
(
0
)
if
reshape
is
None
:
self
.
set_layer_size
(
input_layer
.
size
)
else
:
in_h
=
input_layer
.
height
in_w
=
input_layer
.
width
out_dims
=
None
if
input_layer
.
has_depth
():
in_d
=
input_layer
.
depth
in_c
=
input_layer
.
size
/
in_h
/
in_w
/
in_d
# batch_size, depth, height, width, channel
out_dims
=
[
0
,
in_d
,
in_h
,
in_w
,
in_c
]
else
:
in_c
=
input_layer
.
size
/
in_h
/
in_w
# batch_size, height, width, channel
out_dims
=
[
0
,
in_h
,
in_w
,
in_c
]
# Because (reshape['width'][0] > 0) always be true.
# So out_dims[0] won't be used.
size
=
reduce
(
lambda
x
,
y
:
x
*
y
,
out_dims
[
reshape
[
'width'
][
0
]:])
self
.
set_layer_size
(
size
)
@
config_layer
(
'scale_sub_region'
)
...
...
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
f90c06bc
...
...
@@ -6873,6 +6873,7 @@ def crop_layer(input, offset, axis=2, shape=None, name=None, layer_attr=None):
:param input: The input of this layer. If two inputs are given, the second one
will be regarded as the reference.
And the input must be 4-dims and in NCHW order.
:type input: LayerOutput | Sequence
:param offset: The crop offset.
:type offset: Sequence
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录