Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
f28f41db
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
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看板
提交
f28f41db
编写于
6月 05, 2018
作者:
T
tangwei12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update io.py annotations and codes
上级
6db240d7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
14 deletion
+13
-14
python/paddle/fluid/io.py
python/paddle/fluid/io.py
+13
-14
未找到文件。
python/paddle/fluid/io.py
浏览文件 @
f28f41db
...
...
@@ -483,11 +483,11 @@ def save_checkpoint(executor,
:param main_program
:param max_num_checkpoints
"""
if
checkpoint_dir
is
None
:
raise
ValueError
(
"
The values of
'checkpoint_dir' should not be None"
)
if
checkpoint_dir
.
strip
()
is
None
:
raise
ValueError
(
"'checkpoint_dir' should not be None"
)
if
trainer_args
and
not
isinstance
(
trainer_args
,
dict
)
:
raise
TypeError
(
"The type of 'trainer_args' should be dict"
)
if
trainer_args
:
assert
isinstance
(
trainer_args
,
dict
)
if
not
os
.
path
.
isdir
(
checkpoint_dir
):
os
.
makedirs
(
checkpoint_dir
)
...
...
@@ -514,11 +514,11 @@ def load_checkpoint(executor, checkpoint_dir, serial, main_program):
:param main_program
"""
if
checkpoint_dir
is
None
:
raise
ValueError
(
"
The values of
'checkpoint_dir' should not be None"
)
if
checkpoint_dir
.
strip
()
is
None
:
raise
ValueError
(
"'checkpoint_dir' should not be None"
)
if
serial
is
None
or
serial
<
0
:
raise
ValueError
(
"
The values of
'serial' should not be None or <0 "
)
raise
ValueError
(
"'serial' should not be None or <0 "
)
if
main_program
is
None
:
raise
ValueError
(
'main_program should not be None.'
)
...
...
@@ -536,8 +536,8 @@ def clean_checkpoint(checkpoint_dir, delete_dir=False):
:param delete_dir
"""
if
checkpoint_dir
is
None
:
raise
ValueError
(
"
The values of
'checkpoint_dir' should not be None"
)
if
checkpoint_dir
.
strip
()
is
None
:
raise
ValueError
(
"'checkpoint_dir' should not be None"
)
_lru_delete
(
checkpoint_dir
,
max_num_checkpoints
=
0
)
if
delete_dir
and
not
os
.
listdir
(
checkpoint_dir
):
...
...
@@ -590,8 +590,8 @@ def save_persist_vars_without_grad(executor, dirname, program):
def
save_trainer_args
(
dirname
,
trainer_id
,
trainer_args
):
if
not
isinstance
(
trainer_args
,
dict
):
raise
TypeError
(
"The type of 'trainer_args' should be dict"
)
assert
isinstance
(
trainer_args
,
dict
)
cur_dir
=
_get_trainer_dir
(
dirname
,
trainer_id
)
for
name
,
value
in
trainer_args
.
iteritems
():
...
...
@@ -602,12 +602,11 @@ def save_trainer_args(dirname, trainer_id, trainer_args):
def
load_trainer_args
(
checkpoint_dir
,
serial
,
trainer_id
,
trainer_args
):
assert
isinstance
(
trainer_args
,
list
)
cur_dir
=
_get_serial_dir
(
checkpoint_dir
,
serial
)
cur_dir
=
_get_trainer_dir
(
cur_dir
,
trainer_id
)
if
not
isinstance
(
trainer_args
,
list
):
raise
TypeError
(
"The type of 'trainer_args' should be list"
)
ret_values
=
[]
for
arg
in
trainer_args
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录