Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
b73ea6a7
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看板
提交
b73ea6a7
编写于
7月 30, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
7月 30, 2020
浏览文件
操作
浏览文件
下载
差异文件
!3668 Modify collecting graph and dataset graph to step end stage
Merge pull request !3668 from ougongchang/fix_collect_dataset
上级
567509af
1dafb2c6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
19 deletion
+14
-19
mindspore/train/callback/_summary_collector.py
mindspore/train/callback/_summary_collector.py
+14
-19
未找到文件。
mindspore/train/callback/_summary_collector.py
浏览文件 @
b73ea6a7
...
...
@@ -182,7 +182,7 @@ class SummaryCollector(Callback):
self
.
_custom_lineage_data
=
custom_lineage_data
self
.
_temp_optimizer
=
None
self
.
_has_saved_
train_network
=
False
self
.
_has_saved_
graph
=
False
self
.
_has_saved_custom_data
=
False
self
.
_is_parse_loss_success
=
True
self
.
_first_step
=
True
...
...
@@ -287,32 +287,30 @@ class SummaryCollector(Callback):
'but got `{cb_params.mode}` mode.'
)
self
.
_record
.
set_mode
(
cb_params
.
mode
)
if
cb_params
.
mode
==
ModeEnum
.
TRAIN
.
value
:
# Note: if model.init is not executed then the computed graph will not be obtained here
# The purpose of recording the graph here was to collect_freq if it was set to a large size,
# but also want to see the graph as soon after compilation.
self
.
_collect_graphs
(
cb_params
)
self
.
_collect_dataset_graph
(
cb_params
)
if
cb_params
.
mode
==
ModeEnum
.
TRAIN
.
value
:
if
self
.
_collect_tensor_freq
is
None
:
default_tensor_summary_limit
=
20
total_step
=
cb_params
.
epoch_num
*
cb_params
.
batch_num
self
.
_collect_tensor_freq
=
max
(
self
.
_collect_freq
,
total_step
//
default_tensor_summary_limit
)
if
self
.
_custom_lineage_data
and
not
self
.
_has_saved_custom_data
:
packaged_custom_data
=
self
.
_package_custom_lineage_data
(
self
.
_custom_lineage_data
)
self
.
_record
.
add_value
(
'custom_lineage_data'
,
'custom_lineage_data'
,
packaged_custom_data
)
self
.
_has_saved_custom_data
=
True
# There's nothing special about setting step to 0 here, just to satisfy the interface call
self
.
_record
.
record
(
step
=
0
)
def
step_end
(
self
,
run_context
):
cb_params
=
run_context
.
original_args
()
if
cb_params
.
mode
!=
ModeEnum
.
TRAIN
.
value
:
return
if
not
self
.
_has_saved_train_network
:
if
not
self
.
_has_saved_graph
:
self
.
_collect_graphs
(
cb_params
)
self
.
_collect_dataset_graph
(
cb_params
)
self
.
_has_saved_graph
=
True
self
.
_record
.
record
(
cb_params
.
cur_step_num
)
if
self
.
_custom_lineage_data
and
not
self
.
_has_saved_custom_data
:
packaged_custom_data
=
self
.
_package_custom_lineage_data
(
self
.
_custom_lineage_data
)
self
.
_record
.
add_value
(
'custom_lineage_data'
,
'custom_lineage_data'
,
packaged_custom_data
)
self
.
_has_saved_custom_data
=
True
self
.
_record
.
record
(
cb_params
.
cur_step_num
)
if
self
.
_first_step
:
# Notice: This way of determining whether dataset sink mode is True does not work in the eval scenario
self
.
_dataset_sink_mode
=
cb_params
.
cur_step_num
==
cb_params
.
batch_num
...
...
@@ -327,14 +325,12 @@ class SummaryCollector(Callback):
elif
current
%
self
.
_collect_freq
==
0
:
self
.
_collect_at_step_end
(
cb_params
,
lambda
plugin
:
plugin
!=
PluginEnum
.
TENSOR
.
value
)
def
_collect_at_step_end
(
self
,
cb_params
,
plugin_filter
):
self
.
_collect_input_data
(
cb_params
)
self
.
_collect_metric
(
cb_params
)
self
.
_collect_histogram
(
cb_params
)
self
.
_record
.
record
(
cb_params
.
cur_step_num
,
plugin_filter
=
plugin_filter
)
def
end
(
self
,
run_context
):
cb_params
=
run_context
.
original_args
()
if
cb_params
.
mode
==
ModeEnum
.
TRAIN
.
value
:
...
...
@@ -428,7 +424,6 @@ class SummaryCollector(Callback):
if
graph_proto
is
None
:
return
self
.
_has_saved_train_network
=
True
self
.
_record
.
add_value
(
PluginEnum
.
GRAPH
.
value
,
'train_network/auto'
,
graph_proto
)
def
_collect_metric
(
self
,
cb_params
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录