Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
e901de66
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e901de66
编写于
5月 22, 2018
作者:
T
tangwei12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update var name
上级
2412dee3
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
7 addition
and
7 deletion
+7
-7
python/paddle/fluid/io.py
python/paddle/fluid/io.py
+7
-7
未找到文件。
python/paddle/fluid/io.py
浏览文件 @
e901de66
...
@@ -23,7 +23,7 @@ from . import core
...
@@ -23,7 +23,7 @@ from . import core
__all__
=
[
__all__
=
[
'save_vars'
,
'save_params'
,
'save_persistables'
,
'load_vars'
,
'load_params'
,
'save_vars'
,
'save_params'
,
'save_persistables'
,
'load_vars'
,
'load_params'
,
'load_persistables'
,
'save_inference_model'
,
'load_inference_model'
,
'load_persistables'
,
'save_inference_model'
,
'load_inference_model'
,
'get_inference_program'
,
'save_checkpoint'
,
'
restore
_checkpoint'
'get_inference_program'
,
'save_checkpoint'
,
'
load
_checkpoint'
]
]
...
@@ -466,7 +466,7 @@ def save_checkpoint(executor,
...
@@ -466,7 +466,7 @@ def save_checkpoint(executor,
Save Variables to Checkpoint Directory
Save Variables to Checkpoint Directory
:param dirname
:param dirname
:param
keep_max
:param
max_num_checkpoints
:param save_secs
:param save_secs
:param main_program
:param main_program
"""
"""
...
@@ -495,7 +495,7 @@ def save_checkpoint(executor,
...
@@ -495,7 +495,7 @@ def save_checkpoint(executor,
_lru_delete
(
dirname
,
max_num_checkpoints
)
_lru_delete
(
dirname
,
max_num_checkpoints
)
def
restore
_checkpoint
(
executor
,
dirname
=
None
,
main_program
=
None
):
def
load
_checkpoint
(
executor
,
dirname
=
None
,
main_program
=
None
):
"""
"""
Load Variables from Checkpint Dir
Load Variables from Checkpint Dir
...
@@ -544,9 +544,9 @@ def _interval_secs_exceed(dirname, save_interval_secs):
...
@@ -544,9 +544,9 @@ def _interval_secs_exceed(dirname, save_interval_secs):
return
True
return
True
def
_lru_delete
(
dirname
,
keep_max
=
3
):
def
_lru_delete
(
dirname
,
max_num_checkpoints
=
3
):
"""
"""
retain checkpoint nums with
keep_max
retain checkpoint nums with
max_num_checkpoints
"""
"""
dirs
=
os
.
listdir
(
dirname
)
dirs
=
os
.
listdir
(
dirname
)
serials
=
[]
serials
=
[]
...
@@ -556,11 +556,11 @@ def _lru_delete(dirname, keep_max=3):
...
@@ -556,11 +556,11 @@ def _lru_delete(dirname, keep_max=3):
except
ValueError
:
except
ValueError
:
continue
continue
if
len
(
serials
)
<=
keep_max
:
if
len
(
serials
)
<=
max_num_checkpoints
:
return
return
serials
.
sort
(
reverse
=
True
)
serials
.
sort
(
reverse
=
True
)
serials
=
serials
[
keep_max
:]
serials
=
serials
[
max_num_checkpoints
:]
for
serial
in
serials
:
for
serial
in
serials
:
cur_dir
=
os
.
path
.
join
(
dirname
,
str
(
serial
))
cur_dir
=
os
.
path
.
join
(
dirname
,
str
(
serial
))
shutil
.
rmtree
(
cur_dir
)
shutil
.
rmtree
(
cur_dir
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录