Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
299469ba
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
299469ba
编写于
6月 30, 2020
作者:
L
Li Hongzhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
address the importance of closing the SummaryRecord and illustrate how
上级
10cfc235
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
6 deletion
+17
-6
mindspore/train/summary/summary_record.py
mindspore/train/summary/summary_record.py
+17
-6
未找到文件。
mindspore/train/summary/summary_record.py
浏览文件 @
299469ba
...
@@ -61,12 +61,14 @@ def _dictlist():
...
@@ -61,12 +61,14 @@ def _dictlist():
class
SummaryRecord
:
class
SummaryRecord
:
"""
"""
SummaryRecord is used to record the summary data and lineage data.
SummaryRecord is used to record the summary data and lineage data.
The API will create a summary file and a lineage file lazily in a given directory and writes data to them.
It writes the data to files by executing the record method. In addition to record the data bubbled up from
the network by defining the summary operators, SummaryRecord also supports to record extra data which
can be added by calling add_value.
Note:
Note:
The API will create a summary file and a lineage file lazily in a given directory and writes data to them.
Make sure to close the SummaryRecord at the end, or the process will NOT exit.
It writes the data to files by executing the record method. In addition to record the data bubbled up from
Please see the Example section below on how to properly close with two ways.
the network by defining the summary operators, SummaryRecord also supports to record extra data which
can be added by calling add_value. Finally, make sure to close the SummaryRecord object at the end.
Args:
Args:
log_dir (str): The log_dir is a directory location to save the summary.
log_dir (str): The log_dir is a directory location to save the summary.
...
@@ -81,8 +83,15 @@ class SummaryRecord:
...
@@ -81,8 +83,15 @@ class SummaryRecord:
RuntimeError: If the log_dir can not be resolved to a canonicalized absolute pathname.
RuntimeError: If the log_dir can not be resolved to a canonicalized absolute pathname.
Examples:
Examples:
>>> # use in with statement to auto close
>>> with SummaryRecord(log_dir="/opt/log", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> with SummaryRecord(log_dir="/opt/log", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> pass
>>> pass
>>>
>>> # use in try .. finally .. to ensure closing
>>> try:
>>> summary_record = SummaryRecord(log_dir="/opt/log")
>>> finally:
>>> summary_record.close()
"""
"""
def
__init__
(
self
,
def
__init__
(
self
,
...
@@ -310,8 +319,10 @@ class SummaryRecord:
...
@@ -310,8 +319,10 @@ class SummaryRecord:
Flush all events and close summary records. Please use with statement to autoclose.
Flush all events and close summary records. Please use with statement to autoclose.
Examples:
Examples:
>>> with SummaryRecord(log_dir="/opt/log", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> try:
>>> pass # summary_record autoclosed
>>> summary_record = SummaryRecord(log_dir="/opt/log")
>>> finally:
>>> summary_record.close()
"""
"""
if
not
self
.
_closed
and
self
.
_event_writer
:
if
not
self
.
_closed
and
self
.
_event_writer
:
# event writer flush and close
# event writer flush and close
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录