Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
dbaabc94
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dbaabc94
编写于
9月 07, 2016
作者:
L
Luo Tao
提交者:
Yu Yang
9月 08, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix unitest of test_RecurrentGradientMachine, and some tiny doc update
Change-Id: I028e402c964ca4f4431cbf8153bea4379dd4df70
上级
d6d91223
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
24 deletion
+30
-24
doc/demo/imagenet_model/resnet_model.md
doc/demo/imagenet_model/resnet_model.md
+1
-1
doc/demo/rec/ml_regression.rst
doc/demo/rec/ml_regression.rst
+1
-1
paddle/gserver/tests/sequenceGen.py
paddle/gserver/tests/sequenceGen.py
+18
-12
paddle/gserver/tests/sequence_layer_group.conf
paddle/gserver/tests/sequence_layer_group.conf
+5
-5
paddle/gserver/tests/sequence_nest_layer_group.conf
paddle/gserver/tests/sequence_nest_layer_group.conf
+5
-5
未找到文件。
doc/demo/imagenet_model/resnet_model.md
浏览文件 @
dbaabc94
...
@@ -165,7 +165,7 @@ We provide both C++ and Python interfaces to extract features. The following exa
...
@@ -165,7 +165,7 @@ We provide both C++ and Python interfaces to extract features. The following exa
### C++ Interface
### C++ Interface
First, specify image data list in
`define_py_data_sources`
in the config, see example
`demo/model_zoo/resnet/resnet.py`
.
First, specify image data list in
`define_py_data_sources
2
`
in the config, see example
`demo/model_zoo/resnet/resnet.py`
.
```
```
train_list = 'train.list' if not is_test else None
train_list = 'train.list' if not is_test else None
...
...
doc/demo/rec/ml_regression.rst
浏览文件 @
dbaabc94
...
@@ -257,7 +257,7 @@ In these network, we use several api in `trainer_config_helpers
...
@@ -257,7 +257,7 @@ In these network, we use several api in `trainer_config_helpers
* Text Convolution Pooling Layer, `text_conv_pool
* Text Convolution Pooling Layer, `text_conv_pool
<../../ui/api/trainer_config_helpers/networks.html
<../../ui/api/trainer_config_helpers/networks.html
#trainer_config_helpers.networks.text_conv_pool>`_
#trainer_config_helpers.networks.text_conv_pool>`_
* Declare Python Data Sources, `define_py_data_sources
* Declare Python Data Sources, `define_py_data_sources
2
<../../ui/api/trainer_config_helpers/data_sources.html>`_
<../../ui/api/trainer_config_helpers/data_sources.html>`_
Data Provider
Data Provider
...
...
paddle/gserver/tests/sequenceGen.py
浏览文件 @
dbaabc94
...
@@ -18,27 +18,33 @@
...
@@ -18,27 +18,33 @@
import
os
import
os
import
sys
import
sys
from
paddle.trainer.PyDataProvider
Wrapper
import
*
from
paddle.trainer.PyDataProvider
2
import
*
@
init_hook_wrapper
def
hook
(
settings
,
dict_file
,
**
kwargs
):
def
hook
(
obj
,
dict_file
,
**
kwargs
):
settings
.
word_dict
=
dict_file
obj
.
word_dict
=
dict_file
settings
.
input_types
=
[
integer_value_sequence
(
len
(
settings
.
word_dict
)),
obj
.
slots
=
[
IndexSlot
(
len
(
obj
.
word_dict
)),
IndexSlot
(
3
)]
integer_value_sequence
(
3
)]
obj
.
logger
.
info
(
'dict len : %d'
%
(
len
(
obj
.
word_dict
)))
settings
.
logger
.
info
(
'dict len : %d'
%
(
len
(
settings
.
word_dict
)))
@
provider
(
use_seq
=
True
,
init_hook
=
hook
)
@
provider
(
init_hook
=
hook
)
def
process
(
obj
,
file_name
):
def
process
(
settings
,
file_name
):
with
open
(
file_name
,
'r'
)
as
fdata
:
with
open
(
file_name
,
'r'
)
as
fdata
:
for
line
in
fdata
:
for
line
in
fdata
:
label
,
comment
=
line
.
strip
().
split
(
'
\t
'
)
label
,
comment
=
line
.
strip
().
split
(
'
\t
'
)
label
=
int
(
''
.
join
(
label
.
split
()))
label
=
int
(
''
.
join
(
label
.
split
()))
words
=
comment
.
split
()
words
=
comment
.
split
()
word_slot
=
[
obj
.
word_dict
[
w
]
for
w
in
words
if
w
in
obj
.
word_dict
]
word_slot
=
[
settings
.
word_dict
[
w
]
for
w
in
words
if
w
in
settings
.
word_dict
]
yield
word_slot
,
[
label
]
yield
word_slot
,
[
label
]
## for hierarchical sequence network
## for hierarchical sequence network
@
provider
(
use_seq
=
True
,
init_hook
=
hook
)
def
hook2
(
settings
,
dict_file
,
**
kwargs
):
def
process2
(
obj
,
file_name
):
settings
.
word_dict
=
dict_file
settings
.
input_types
=
[
integer_value_sub_sequence
(
len
(
settings
.
word_dict
)),
integer_value_sub_sequence
(
3
)]
settings
.
logger
.
info
(
'dict len : %d'
%
(
len
(
settings
.
word_dict
)))
@
provider
(
init_hook
=
hook2
)
def
process2
(
settings
,
file_name
):
with
open
(
file_name
)
as
fdata
:
with
open
(
file_name
)
as
fdata
:
label_list
=
[]
label_list
=
[]
word_slot_list
=
[]
word_slot_list
=
[]
...
@@ -47,7 +53,7 @@ def process2(obj, file_name):
...
@@ -47,7 +53,7 @@ def process2(obj, file_name):
label
,
comment
=
line
.
strip
().
split
(
'
\t
'
)
label
,
comment
=
line
.
strip
().
split
(
'
\t
'
)
label
=
int
(
''
.
join
(
label
.
split
()))
label
=
int
(
''
.
join
(
label
.
split
()))
words
=
comment
.
split
()
words
=
comment
.
split
()
word_slot
=
[
obj
.
word_dict
[
w
]
for
w
in
words
if
w
in
obj
.
word_dict
]
word_slot
=
[
settings
.
word_dict
[
w
]
for
w
in
words
if
w
in
settings
.
word_dict
]
label_list
.
append
([
label
])
label_list
.
append
([
label
])
word_slot_list
.
append
(
word_slot
)
word_slot_list
.
append
(
word_slot
)
else
:
else
:
...
...
paddle/gserver/tests/sequence_layer_group.conf
浏览文件 @
dbaabc94
...
@@ -21,11 +21,11 @@ dict_file = dict()
...
@@ -21,11 +21,11 @@ dict_file = dict()
for
line_count
,
line
in
enumerate
(
open
(
dict_path
,
"r"
)):
for
line_count
,
line
in
enumerate
(
open
(
dict_path
,
"r"
)):
dict_file
[
line
.
strip
()] =
line_count
dict_file
[
line
.
strip
()] =
line_count
define_py_data_sources
(
train_list
=
'gserver/tests/Sequence/train.list'
,
define_py_data_sources
2
(
train_list
=
'gserver/tests/Sequence/train.list'
,
test_list
=
None
,
test_list
=
None
,
module
=
'sequenceGen'
,
module
=
'sequenceGen'
,
obj
=
'process'
,
obj
=
'process'
,
args
={
"dict_file"
:
dict_file
})
args
={
"dict_file"
:
dict_file
})
settings
(
batch_size
=
5
)
settings
(
batch_size
=
5
)
######################## network configure ################################
######################## network configure ################################
...
...
paddle/gserver/tests/sequence_nest_layer_group.conf
浏览文件 @
dbaabc94
...
@@ -21,11 +21,11 @@ dict_file = dict()
...
@@ -21,11 +21,11 @@ dict_file = dict()
for
line_count
,
line
in
enumerate
(
open
(
dict_path
,
"r"
)):
for
line_count
,
line
in
enumerate
(
open
(
dict_path
,
"r"
)):
dict_file
[
line
.
strip
()] =
line_count
dict_file
[
line
.
strip
()] =
line_count
define_py_data_sources
(
train_list
=
'gserver/tests/Sequence/train.list.nest'
,
define_py_data_sources
2
(
train_list
=
'gserver/tests/Sequence/train.list.nest'
,
test_list
=
None
,
test_list
=
None
,
module
=
'sequenceGen'
,
module
=
'sequenceGen'
,
obj
=
'process2'
,
obj
=
'process2'
,
args
={
"dict_file"
:
dict_file
})
args
={
"dict_file"
:
dict_file
})
settings
(
batch_size
=
2
)
settings
(
batch_size
=
2
)
######################## network configure ################################
######################## network configure ################################
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录