Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
eaf9edbf
M
mindinsight
项目概览
MindSpore
/
mindinsight
通知
7
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindinsight
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
eaf9edbf
编写于
7月 27, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
7月 27, 2020
浏览文件
操作
浏览文件
下载
差异文件
!458 extract the function of _event_parse so that its code line is reasonable.
Merge pull request !458 from wangshuide/fix_ci
上级
2cb75b2e
6630ca0b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
42 addition
and
24 deletion
+42
-24
mindinsight/datavisual/data_transform/ms_data_loader.py
mindinsight/datavisual/data_transform/ms_data_loader.py
+42
-24
未找到文件。
mindinsight/datavisual/data_transform/ms_data_loader.py
浏览文件 @
eaf9edbf
...
...
@@ -416,6 +416,44 @@ class _SummaryParser(_Parser):
return
event_str
@
staticmethod
def
_parse_summary_value
(
value
,
plugin
):
"""
Parse summary value and create corresponding container according to plugin.
Args:
value (Summary.Value): Value message in summary file.
plugin (str): Plugin value.
Returns:
Union[Summary.Value, HistogramContainer, TensorContainer, ImageContainer], original summary value
or an instance of HistogramContainer or TensorContainer or ImageContainer.
"""
tensor_event_value
=
getattr
(
value
,
plugin
)
if
plugin
==
PluginNameEnum
.
HISTOGRAM
.
value
:
tensor_event_value
=
HistogramContainer
(
tensor_event_value
)
# Drop steps if original_buckets_count exceeds HistogramContainer.MAX_ORIGINAL_BUCKETS_COUNT
# to avoid time-consuming re-sample process.
if
tensor_event_value
.
histogram
.
original_buckets_count
>
Histogram
.
MAX_ORIGINAL_BUCKETS_COUNT
:
logger
.
info
(
'original_buckets_count exceeds '
'HistogramContainer.MAX_ORIGINAL_BUCKETS_COUNT'
)
return
None
elif
plugin
==
PluginNameEnum
.
TENSOR
.
value
:
tensor_event_value
=
TensorContainer
(
tensor_event_value
)
tensor_count
=
1
for
d
in
tensor_event_value
.
dims
:
tensor_count
*=
d
if
tensor_count
>
MAX_TENSOR_COUNT
:
logger
.
warning
(
'tag: %s/tensor, dims: %s, tensor count: %d exceeds %d and drop it.'
,
value
.
tag
,
tensor_event_value
.
dims
,
tensor_count
,
MAX_TENSOR_COUNT
)
return
None
elif
plugin
==
PluginNameEnum
.
IMAGE
.
value
:
tensor_event_value
=
ImageContainer
(
tensor_event_value
)
return
tensor_event_value
@
staticmethod
def
_event_parse
(
event_str
,
latest_file_name
):
"""
...
...
@@ -424,7 +462,7 @@ class _SummaryParser(_Parser):
This method is static to avoid sending unnecessary objects to other processes.
Args:
event (str): Message event string in summary proto, data read from file handler.
event
_str
(str): Message event string in summary proto, data read from file handler.
latest_file_name (str): Latest file name.
"""
...
...
@@ -445,31 +483,11 @@ class _SummaryParser(_Parser):
if
not
value
.
HasField
(
plugin
):
continue
plugin_name_enum
=
plugins
[
plugin
]
tensor_event_value
=
getattr
(
value
,
plugin
)
logger
.
debug
(
"Processing plugin value: %s."
,
plugin_name_enum
)
if
plugin
==
PluginNameEnum
.
HISTOGRAM
.
value
:
tensor_event_value
=
HistogramContainer
(
tensor_event_value
)
# Drop steps if original_buckets_count exceeds HistogramContainer.MAX_ORIGINAL_BUCKETS_COUNT
# to avoid time-consuming re-sample process.
if
tensor_event_value
.
histogram
.
original_buckets_count
>
Histogram
.
MAX_ORIGINAL_BUCKETS_COUNT
:
logger
.
info
(
'original_buckets_count exceeds '
'HistogramContainer.MAX_ORIGINAL_BUCKETS_COUNT'
)
continue
elif
plugin
==
PluginNameEnum
.
TENSOR
.
value
:
tensor_event_value
=
TensorContainer
(
tensor_event_value
)
tensor_count
=
1
for
d
in
tensor_event_value
.
dims
:
tensor_count
*=
d
if
tensor_count
>
MAX_TENSOR_COUNT
:
logger
.
warning
(
'tag: %s/tensor, tensor count: %d exceeds %d and drop it.'
,
value
.
tag
,
tensor_count
,
MAX_TENSOR_COUNT
)
tensor_event_value
=
_SummaryParser
.
_parse_summary_value
(
value
,
plugin
)
if
tensor_event_value
is
None
:
continue
elif
plugin
==
PluginNameEnum
.
IMAGE
.
value
:
tensor_event_value
=
ImageContainer
(
tensor_event_value
)
tensor_event
=
TensorEvent
(
wall_time
=
event
.
wall_time
,
step
=
event
.
step
,
tag
=
'{}/{}'
.
format
(
value
.
tag
,
plugin_name_enum
.
value
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录