Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
91a0c11b
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
12 个月 前同步成功
通知
692
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
91a0c11b
编写于
9月 08, 2017
作者:
C
chengduoZH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adaptive data structure for SwitchOrderLayer
上级
544458e0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
4 deletion
+14
-4
paddle/gserver/layers/SwitchOrderLayer.cpp
paddle/gserver/layers/SwitchOrderLayer.cpp
+5
-2
proto/ModelConfig.proto
proto/ModelConfig.proto
+1
-0
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+8
-2
未找到文件。
paddle/gserver/layers/SwitchOrderLayer.cpp
浏览文件 @
91a0c11b
...
...
@@ -24,10 +24,12 @@ bool SwitchOrderLayer::init(const LayerMap& layerMap,
/* Initialize the basic parent class */
Layer
::
init
(
layerMap
,
parameterMap
);
auto
&
img_conf
=
config_
.
inputs
(
0
).
image_conf
();
size_t
inD
=
img_conf
.
img_size_z
();
size_t
inH
=
img_conf
.
has_img_size_y
()
?
img_conf
.
img_size_y
()
:
img_conf
.
img_size
();
size_t
inW
=
img_conf
.
img_size
();
size_t
inC
=
img_conf
.
channels
();
inH
=
inH
*
inD
;
inDims_
=
TensorShape
({
0
,
inC
,
inH
,
inW
});
outDims_
=
TensorShape
(
4
);
...
...
@@ -64,9 +66,10 @@ void SwitchOrderLayer::setInDims() {
MatrixPtr
input
=
inputLayers_
[
0
]
->
getOutputValue
();
size_t
batchSize
=
input
->
getHeight
();
inDims_
.
setDim
(
0
,
batchSize
);
int
d
=
inputLayers_
[
0
]
->
getOutput
().
getFrameDepth
();
d
=
(
d
==
0
?
1
:
d
);
int
h
=
inputLayers_
[
0
]
->
getOutput
().
getFrameHeight
();
if
(
h
!=
0
)
inDims_
.
setDim
(
2
,
h
);
if
(
h
!=
0
)
inDims_
.
setDim
(
2
,
h
*
d
);
int
w
=
inputLayers_
[
0
]
->
getOutput
().
getFrameWidth
();
if
(
w
!=
0
)
inDims_
.
setDim
(
3
,
w
);
int
totalCount
=
input
->
getElementCnt
();
...
...
proto/ModelConfig.proto
浏览文件 @
91a0c11b
...
...
@@ -271,6 +271,7 @@ message ImageConfig {
// The size of input feature map.
required
uint32
img_size
=
8
;
optional
uint32
img_size_y
=
9
;
optional
uint32
img_size_z
=
10
[
default
=
1
];
}
message
PriorBoxConfig
{
...
...
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
91a0c11b
...
...
@@ -6410,7 +6410,7 @@ def gated_unit_layer(input,
@
wrap_name_default
(
'switch_order'
)
def
switch_order_layer
(
input
,
name
=
None
,
reshape
=
None
,
reshape
_axis
=
None
,
act
=
None
,
layer_attr
=
None
):
"""
...
...
@@ -6421,8 +6421,9 @@ def switch_order_layer(input,
The example usage is:
.. code-block:: python
reshape_axis = 3
switch = switch_order(input=layer, name='switch', reshape_axis=reshape_axis)
reshape = {'height':[ 0, 1, 2], 'width':[3]}
switch = switch_order(input=layer, name='switch', reshape=reshape)
:param input: The input layer.
:type input: LayerOutput
...
...
@@ -6434,6 +6435,11 @@ def switch_order_layer(input,
:rtype: LayerOutput
"""
assert
isinstance
(
input
,
LayerOutput
)
assert
reshape_axis
!=
None
and
(
reshape_axis
>
0
and
reshape_axis
<
4
)
height
=
[
ele
for
ele
in
xrange
(
reshape_axis
)]
width
=
[
ele
for
ele
in
range
(
reshape_axis
,
4
)]
reshape
=
{
'height'
:
height
,
'width'
:
width
}
l
=
Layer
(
name
=
name
,
inputs
=
input
.
name
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录