Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PALM
提交
57adbb6c
P
PALM
项目概览
PaddlePaddle
/
PALM
通知
5
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PALM
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
57adbb6c
编写于
2月 17, 2020
作者:
X
Xiaoyao Xi
提交者:
GitHub
2月 17, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #58 from wangxiao1021/api
fix bugs
上级
befa7781
9b171a0e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
4 addition
and
4 deletion
+4
-4
paddlepalm/trainer.py
paddlepalm/trainer.py
+2
-2
paddlepalm/utils/reader_helper.py
paddlepalm/utils/reader_helper.py
+2
-2
未找到文件。
paddlepalm/trainer.py
浏览文件 @
57adbb6c
...
@@ -168,10 +168,10 @@ class Trainer(object):
...
@@ -168,10 +168,10 @@ class Trainer(object):
if
not
self
.
_lock_prog
:
if
not
self
.
_lock_prog
:
with
fluid
.
program_guard
(
train_prog
,
train_init_prog
):
with
fluid
.
program_guard
(
train_prog
,
train_init_prog
):
net_inputs
=
reader_helper
.
create_net_inputs
(
input_attrs
,
async
=
False
)
net_inputs
=
reader_helper
.
create_net_inputs
(
input_attrs
,
is_
async
=
False
)
bb_output_vars
=
backbone
.
build
(
net_inputs
)
bb_output_vars
=
backbone
.
build
(
net_inputs
)
else
:
else
:
net_inputs
=
reader_helper
.
create_net_inputs
(
input_attrs
,
async
=
False
)
net_inputs
=
reader_helper
.
create_net_inputs
(
input_attrs
,
is_
async
=
False
)
bb_output_vars
=
backbone
.
build
(
net_inputs
)
bb_output_vars
=
backbone
.
build
(
net_inputs
)
self
.
_net_inputs
=
net_inputs
self
.
_net_inputs
=
net_inputs
assert
sorted
(
bb_output_vars
.
keys
())
==
sorted
(
backbone
.
outputs_attr
.
keys
())
assert
sorted
(
bb_output_vars
.
keys
())
==
sorted
(
backbone
.
outputs_attr
.
keys
())
...
...
paddlepalm/utils/reader_helper.py
浏览文件 @
57adbb6c
...
@@ -117,7 +117,7 @@ def _zero_batch_x(attrs, batch_size):
...
@@ -117,7 +117,7 @@ def _zero_batch_x(attrs, batch_size):
return
[
np
.
zeros
(
shape
=
shape
,
dtype
=
dtype
)
for
shape
,
dtype
in
pos_attrs
]
return
[
np
.
zeros
(
shape
=
shape
,
dtype
=
dtype
)
for
shape
,
dtype
in
pos_attrs
]
def
create_net_inputs
(
input_attrs
,
async
=
False
,
iterator_fn
=
None
,
dev_count
=
1
,
n_prefetch
=
1
):
def
create_net_inputs
(
input_attrs
,
is_
async
=
False
,
iterator_fn
=
None
,
dev_count
=
1
,
n_prefetch
=
1
):
inputs
=
[]
inputs
=
[]
ret
=
{}
ret
=
{}
for
name
,
shape
,
dtype
in
input_attrs
:
for
name
,
shape
,
dtype
in
input_attrs
:
...
@@ -125,7 +125,7 @@ def create_net_inputs(input_attrs, async=False, iterator_fn=None, dev_count=1, n
...
@@ -125,7 +125,7 @@ def create_net_inputs(input_attrs, async=False, iterator_fn=None, dev_count=1, n
ret
[
name
]
=
p
ret
[
name
]
=
p
inputs
.
append
(
p
)
inputs
.
append
(
p
)
if
async
:
if
is_
async
:
assert
iterator_fn
is
not
None
,
"iterator_fn is needed for building async input layer."
assert
iterator_fn
is
not
None
,
"iterator_fn is needed for building async input layer."
reader
=
fluid
.
io
.
PyReader
(
inputs
,
capacity
=
dev_count
,
iterable
=
False
)
reader
=
fluid
.
io
.
PyReader
(
inputs
,
capacity
=
dev_count
,
iterable
=
False
)
reader
.
decorate_batch_generator
(
iterator_fn
)
reader
.
decorate_batch_generator
(
iterator_fn
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录