Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
ccad0cae
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看板
提交
ccad0cae
编写于
7月 06, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
7月 06, 2020
浏览文件
操作
浏览文件
下载
差异文件
!2856 Update the Api document of SummaryCollector and SummaryRecord.
Merge pull request !2856 from ougongchang/fix_summary_record
上级
bb44e908
0ee568b7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
13 deletion
+16
-13
mindspore/train/callback/_summary_collector.py
mindspore/train/callback/_summary_collector.py
+1
-0
mindspore/train/summary/summary_record.py
mindspore/train/summary/summary_record.py
+15
-13
未找到文件。
mindspore/train/callback/_summary_collector.py
浏览文件 @
ccad0cae
...
...
@@ -83,6 +83,7 @@ class SummaryCollector(Callback):
The data that supports control is shown below.
- collect_metric: Whether to collect training metrics, currently only loss is collected.
The first output will be treated as loss, and it will be averaged.
Optional: True/False. Default: True.
- collect_graph: Whether to collect computational graph, currently only
training computational graph is collected. Optional: True/False. Default: True.
...
...
mindspore/train/summary/summary_record.py
浏览文件 @
ccad0cae
...
...
@@ -62,14 +62,16 @@ def _dictlist():
class
SummaryRecord
:
"""
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 API will create a summary file and lineage files 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:
Make sure to close the SummaryRecord at the end, or the process will NOT exit.
Please see the Example section below on how to properly close with two ways.
1. Make sure to close the SummaryRecord at the end, or the process will not exit.
Please see the Example section below on how to properly close with two ways.
2. The SummaryRecord instance can only allow one at a time, otherwise it will cause problems with data writes.
Args:
log_dir (str): The log_dir is a directory location to save the summary.
...
...
@@ -85,12 +87,12 @@ class SummaryRecord:
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="
./summary_dir
") as summary_record:
>>> pass
>>>
>>> # use in try .. finally .. to ensure closing
>>> try:
>>> summary_record = SummaryRecord(log_dir="
/opt/log
")
>>> summary_record = SummaryRecord(log_dir="
./summary_dir
")
>>> finally:
>>> summary_record.close()
"""
...
...
@@ -165,7 +167,7 @@ class SummaryRecord:
ValueError: When the mode is not recognized.
Examples:
>>> with SummaryRecord(log_dir="
/opt/log
", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> with SummaryRecord(log_dir="
./summary_dir
", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> summary_record.set_mode('eval')
"""
mode_spec
=
'train'
,
'eval'
...
...
@@ -204,7 +206,7 @@ class SummaryRecord:
TypeError: When the value is not a Tensor.
Examples:
>>> with SummaryRecord(log_dir="
/opt/log
", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> with SummaryRecord(log_dir="
./summary_dir
", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> summary_record.add_value('scalar', 'loss', Tensor(0.1))
"""
if
plugin
in
(
'tensor'
,
'scalar'
,
'image'
,
'histogram'
):
...
...
@@ -239,10 +241,10 @@ class SummaryRecord:
bool, whether the record process is successful or not.
Examples:
>>> with SummaryRecord(log_dir="
/opt/log
", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> with SummaryRecord(log_dir="
./summary_dir
", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> summary_record.record(step=2)
"""
logger
.
info
(
"SummaryRecord step is %r."
,
step
)
logger
.
debug
(
"SummaryRecord step is %r."
,
step
)
if
self
.
_closed
:
logger
.
error
(
"The record writer is closed."
)
return
False
...
...
@@ -296,7 +298,7 @@ class SummaryRecord:
str, the full path of log file.
Examples:
>>> with SummaryRecord(log_dir="
/opt/log
", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> with SummaryRecord(log_dir="
./summary_dir
", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> print(summary_record.log_dir)
"""
return
self
.
full_file_name
...
...
@@ -308,7 +310,7 @@ class SummaryRecord:
Call it to make sure that all pending events have been written to disk.
Examples:
>>> with SummaryRecord(log_dir="
/opt/log
", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> with SummaryRecord(log_dir="
./summary_dir
", file_prefix="xxx_", file_suffix="_yyy") as summary_record:
>>> summary_record.flush()
"""
if
self
.
_closed
:
...
...
@@ -322,7 +324,7 @@ class SummaryRecord:
Examples:
>>> try:
>>> summary_record = SummaryRecord(log_dir="
/opt/log
")
>>> summary_record = SummaryRecord(log_dir="
./summary_dir
")
>>> finally:
>>> summary_record.close()
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录