Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
2c7d8e7b
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
1 年多 前同步成功
通知
696
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看板
提交
2c7d8e7b
编写于
6月 05, 2017
作者:
E
emailweixu
提交者:
GitHub
6月 05, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2369 from emailweixu/print_layer
Correctly handle print_layer in V2 API
上级
6c7cfad0
252c84db
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
1 deletion
+24
-1
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+9
-1
python/paddle/v2/layer.py
python/paddle/v2/layer.py
+14
-0
python/paddle/v2/tests/test_layer.py
python/paddle/v2/tests/test_layer.py
+1
-0
未找到文件。
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
2c7d8e7b
...
...
@@ -111,6 +111,7 @@ __all__ = [
'block_expand_layer'
,
'maxout_layer'
,
'out_prod_layer'
,
'printer_layer'
,
'print_layer'
,
'priorbox_layer'
,
'cross_channel_norm_layer'
,
...
...
@@ -969,7 +970,7 @@ def fc_layer(input,
@
wrap_name_default
(
"print"
)
def
print_layer
(
input
,
name
=
None
):
def
print
er
_layer
(
input
,
name
=
None
):
"""
Print the output value of input layers. This layer is useful for debugging.
...
...
@@ -991,6 +992,13 @@ def print_layer(input, name=None):
inputs
=
[
l
.
name
for
l
in
input
],
)
# this layer don't return anything, can not be input of other layer.
# Keep print_layer for compatibility with V1 API.
# 'print_layer' does not work for V2 API because it will be changed to
# 'print' for V2 API. But 'print' is a reserved key word in python.
print_layer
=
printer_layer
@
wrap_name_default
(
"priorbox"
)
def
priorbox_layer
(
input
,
...
...
python/paddle/v2/layer.py
浏览文件 @
2c7d8e7b
...
...
@@ -149,6 +149,20 @@ def __get_used_layers__(output_layers, extra_layers=None):
for
layer
in
output_layers
:
dfs_travel
(
layer
.
full_name
)
# print layer needs to be specially handled because no other
# layer depends on it. It is used to print the result of some
# layers when running the model for debug purpose. So we explicitly
# add a print layer to the topolty if its input is in the toplogy.
for
layer
in
cp
.
g_config
.
model_config
.
layers
:
if
layer
.
type
==
'print'
:
used
=
True
for
inp
in
layer
.
inputs
:
if
inp
.
input_layer_name
not
in
layer_names
:
used
=
False
break
if
used
:
layer_names
.
add
(
layer
.
name
)
return
layer_names
...
...
python/paddle/v2/tests/test_layer.py
浏览文件 @
2c7d8e7b
...
...
@@ -164,6 +164,7 @@ class OtherLayerTest(unittest.TestCase):
maxid
=
layer
.
max_id
(
input
=
inference
)
sampling_id
=
layer
.
sampling_id
(
input
=
inference
)
eos
=
layer
.
eos
(
input
=
maxid
,
eos_id
=
5
)
layer
.
printer
(
maxid
)
print
layer
.
parse_network
([
maxid
,
sampling_id
,
eos
])
def
test_slicing_joining_layer
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录