Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wzpei9
Paddle
提交
6245fed2
P
Paddle
项目概览
wzpei9
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6245fed2
编写于
2月 02, 2017
作者:
H
Haonan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rotate_layer python interface fixes
上级
7f4042ec
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
19 addition
and
12 deletion
+19
-12
paddle/gserver/layers/FeatureMapExpandLayer.cpp
paddle/gserver/layers/FeatureMapExpandLayer.cpp
+3
-0
paddle/gserver/layers/GruStepLayer.cpp
paddle/gserver/layers/GruStepLayer.cpp
+2
-2
paddle/gserver/layers/RotateLayer.cpp
paddle/gserver/layers/RotateLayer.cpp
+2
-0
python/paddle/trainer/config_parser.py
python/paddle/trainer/config_parser.py
+3
-3
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+8
-6
python/paddle/trainer_config_helpers/tests/layers_test_config.py
...paddle/trainer_config_helpers/tests/layers_test_config.py
+1
-1
未找到文件。
paddle/gserver/layers/FeatureMapExpandLayer.cpp
浏览文件 @
6245fed2
...
...
@@ -95,6 +95,9 @@ void FeatureMapExpandLayer::forward(PassType passType) {
void
FeatureMapExpandLayer
::
backward
(
const
UpdateCallback
&
callback
)
{
MatrixPtr
inGrad
=
getInputGrad
(
0
);
if
(
NULL
==
inGrad
)
{
return
;
}
MatrixPtr
outGrad
=
getOutputGrad
();
size_t
batchSize
=
getInput
(
0
).
getBatchSize
();
int
imgSize
=
inGrad
->
getWidth
();
...
...
paddle/gserver/layers/GruStepLayer.cpp
浏览文件 @
6245fed2
...
...
@@ -68,8 +68,8 @@ bool GruStepLayer::init(const LayerMap& layerMap,
if
(
!
Layer
::
init
(
layerMap
,
parameterMap
))
return
false
;
CHECK_EQ
(
2U
,
inputLayers_
.
size
());
CHECK_EQ
(
getSize
()
*
getSize
()
*
3
,
parameters_
[
1
]
->
getSize
());
weight_
.
reset
(
new
Weight
(
getSize
(),
getSize
()
*
3
,
parameters_
[
1
]));
CHECK_EQ
(
getSize
()
*
getSize
()
*
3
,
parameters_
[
0
]
->
getSize
());
weight_
.
reset
(
new
Weight
(
getSize
(),
getSize
()
*
3
,
parameters_
[
0
]));
if
(
biasParameter_
.
get
()
!=
NULL
)
{
CHECK_EQ
(
getSize
()
*
3
,
biasParameter_
->
getSize
());
...
...
paddle/gserver/layers/RotateLayer.cpp
浏览文件 @
6245fed2
...
...
@@ -25,6 +25,8 @@ bool RotateLayer::init(const LayerMap& layerMap,
CHECK_EQ
(
inputLayers_
.
size
(),
1UL
);
height_
=
config_
.
height
();
width_
=
config_
.
width
();
CHECK_GT
(
height_
,
0
);
CHECK_GT
(
width_
,
0
);
return
true
;
}
...
...
python/paddle/trainer/config_parser.py
浏览文件 @
6245fed2
...
...
@@ -1969,13 +1969,13 @@ class ResizeLayer(LayerBase):
@
config_layer
(
'rotate'
)
class
RotateLayer
(
LayerBase
):
def
__init__
(
self
,
name
,
inputs
,
height
,
device
=
None
):
def
__init__
(
self
,
name
,
inputs
,
height
,
width
,
device
=
None
):
super
(
RotateLayer
,
self
).
__init__
(
name
,
'rotate'
,
0
,
inputs
=
inputs
,
device
=
device
)
config_assert
(
len
(
self
.
inputs
)
==
1
,
'RotateLayer must have one and only one input'
)
self
.
config
.
height
=
height
self
.
set_layer_height_width
(
height
,
width
)
self
.
set_layer_size
(
self
.
get_input_layer
(
0
).
size
)
...
...
@@ -3007,7 +3007,7 @@ class GruStepLayer(LayerBase):
config_assert
(
input_layer1
.
size
==
size
,
'input_layer1.size != layer.size'
)
self
.
config
.
active_gate_type
=
active_gate_type
self
.
create_input_parameter
(
1
,
size
*
size
*
3
,
[
size
,
size
*
3
])
self
.
create_input_parameter
(
0
,
size
*
size
*
3
,
[
size
,
size
*
3
])
self
.
create_bias_parameter
(
bias
,
size
*
3
)
...
...
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
6245fed2
...
...
@@ -1677,22 +1677,23 @@ def trans_layer(input, name=None, layer_attr=None):
@
wrap_name_default
()
@
layer_support
()
def
rotate_layer
(
input
,
height
,
name
=
None
,
layer_attr
=
None
):
def
rotate_layer
(
input
,
height
,
width
,
name
=
None
,
layer_attr
=
None
):
"""
A layer for rotati
on
(clock-wise), usually used when the input sample
is some image or map.
A layer for rotati
ng 90 degrees
(clock-wise), usually used when the input sample
is some image or
feature
map.
.. math::
y(j,i
) = x(M-i-1,j
)
y(j,i
,:) = x(M-i-1,j,:
)
where :math:`x` is (M x N
) input, and :math:`y` is (N x M
) output.
where :math:`x` is (M x N
x C) input, and :math:`y` is (N x M x C
) output.
The example usage is:
.. code-block:: python
rot = rotate_layer(input=layer,
height=100)
height=100,
width=100)
:param input: Input layer.
:type input: LayerOutput
...
...
@@ -1709,6 +1710,7 @@ def rotate_layer(input, height, name=None, layer_attr=None):
l
=
Layer
(
name
=
name
,
height
=
height
,
width
=
width
,
type
=
LayerType
.
ROTATE_LAYER
,
inputs
=
[
input
.
name
],
**
ExtraLayerAttribute
.
to_kwargs
(
layer_attr
))
...
...
python/paddle/trainer_config_helpers/tests/layers_test_config.py
浏览文件 @
6245fed2
...
...
@@ -39,7 +39,7 @@ z1 = mixed_layer(
assert
z1
.
size
>
0
y2
=
fc_layer
(
input
=
y
,
size
=
15
)
z2
=
rotate_layer
(
input
=
y2
,
height
=
5
)
z2
=
rotate_layer
(
input
=
y2
,
height
=
5
,
width
=
3
)
cos1
=
cos_sim
(
a
=
x1
,
b
=
y1
)
cos3
=
cos_sim
(
a
=
x1
,
b
=
y2
,
size
=
3
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录