Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
FluidDoc
提交
cba90c59
F
FluidDoc
项目概览
PaddlePaddle
/
FluidDoc
通知
5
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
23
列表
看板
标记
里程碑
合并请求
111
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FluidDoc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
23
Issue
23
列表
看板
标记
里程碑
合并请求
111
合并请求
111
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
cba90c59
编写于
10月 09, 2018
作者:
D
dongdaxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more code
上级
d10d4de6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
3 deletion
+32
-3
doc/fluid/design/async_executor/async_executor.md
doc/fluid/design/async_executor/async_executor.md
+32
-3
未找到文件。
doc/fluid/design/async_executor/async_executor.md
浏览文件 @
cba90c59
...
@@ -4,14 +4,43 @@ There are many deep learning applications that use sparse features as inputs, su
...
@@ -4,14 +4,43 @@ There are many deep learning applications that use sparse features as inputs, su
## User Interface Design
## User Interface Design
```
python
```
python
import
paddle
as
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
startup_program
=
fluid
.
default_startup_program
()
startup_program
=
fluid
.
default_startup_program
()
main_program
=
fluid
.
default_main_program
()
main_program
=
fluid
.
default_main_program
()
paddle
.
async_executor
(
startup_program
=
startup_program
,
filelist
=
"filelist.txt"
main_program
=
main_program
)
train_dataset
=
fluid
.
datasets
.
MyFeeder
(
filelist
,
transforms
.
Transform
([
transforms
.
tokenize
()]))
train_loader
=
fluid
.
data
.
DataLoader
(
train_dataset
,
batch_size
=
args
.
batch_size
,
shuffle
=
(
train_sampler
is
None
),
num_workers
=
args
.
workers
,
pin_memory
=
True
,
sampler
=
train_sampler
)
cur_block
=
fluid
.
default_main_program
().
current_block
()
abs_input_var
=
cur_block
.
create_var
(
name
=
'abs_input'
,
shape
=
[
-
1
,
32
,
32
],
dtype
=
'float32'
)
abs_output_var
=
cur_block
.
create_var
(
name
=
'abs_output'
,
shape
=
[
-
1
,
32
,
32
],
dtype
=
'float32'
)
op_desc
=
cur_block
.
desc
.
append_op
()
abs_op
=
Operator
(
block
=
cur_block
,
desc
=
op_desc
,
type
=
'abs'
,
inputs
=
{
'X'
:
[
abs_input_var
]},
outputs
=
{
'Out'
:
[
abs_output_var
]})
for
i
,
(
slots
,
label
)
in
enumerate
(
train_loader
):
paddle
.
async_executor
(
feed_list
=
[
slots
,
label
],
startup_program
=
startup_program
,
main_program
=
main_program
,
fetch_list
=
[
abs_output_var
],
fetch_iter
=
10
)
# do something on fetch list
```
```
## Data Feeding Approach
## Data Feeding Approach
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录