Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
346b64e1
V
VisualDL
项目概览
PaddlePaddle
/
VisualDL
1 年多 前同步成功
通知
88
Star
4655
Fork
642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VisualDL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
346b64e1
编写于
1月 14, 2018
作者:
Y
Yan Chunwei
提交者:
GitHub
1月 14, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix mode match check (#134)
上级
19275c3d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
1 deletion
+18
-1
visualdl/logic/sdk.cc
visualdl/logic/sdk.cc
+2
-1
visualdl/python/storage.py
visualdl/python/storage.py
+16
-0
未找到文件。
visualdl/logic/sdk.cc
浏览文件 @
346b64e1
...
...
@@ -78,7 +78,8 @@ std::string LogReader::GenReadableTag(const std::string& mode,
bool
LogReader
::
TagMatchMode
(
const
std
::
string
&
tag
,
const
std
::
string
&
mode
)
{
if
(
tag
.
size
()
<=
mode
.
size
())
return
false
;
return
tag
.
substr
(
0
,
mode
.
size
())
==
mode
;
return
tag
.
substr
(
0
,
mode
.
size
())
==
mode
&&
(
tag
[
mode
.
size
()]
==
'/'
||
tag
[
mode
.
size
()]
==
'%'
);
}
namespace
components
{
...
...
visualdl/python/storage.py
浏览文件 @
346b64e1
...
...
@@ -4,6 +4,12 @@ from visualdl import core
dtypes
=
(
"float"
,
"double"
,
"int32"
,
"int64"
)
def
check_tag_name_valid
(
tag
):
assert
'%'
not
in
tag
,
"character % is a reserved word, it is not allowed in tag."
def
check_mode_name_valid
(
tag
):
for
char
in
[
'%'
,
'/'
]:
assert
char
not
in
tag
,
"character %s is a reserved word, it is not allowed in mode."
%
char
class
LogReader
(
object
):
"""LogReader is a Python wrapper to read and analysis the data that
...
...
@@ -31,6 +37,7 @@ class LogReader(object):
generated during testing can be marked test.
:return: the reader itself
"""
check_mode_name_valid
(
mode
)
self
.
reader
.
set_mode
(
mode
)
return
self
...
...
@@ -38,6 +45,7 @@ class LogReader(object):
"""
create a new LogReader with mode and return it to user.
"""
check_mode_name_valid
(
mode
)
tmp
=
LogReader
(
dir
,
self
.
reader
.
as_mode
(
mode
))
return
tmp
...
...
@@ -60,6 +68,7 @@ class LogReader(object):
"""
Get a scalar reader with tag and data type
"""
check_tag_name_valid
(
tag
)
type2scalar
=
{
'float'
:
self
.
reader
.
get_scalar_float
,
'double'
:
self
.
reader
.
get_scalar_double
,
...
...
@@ -71,6 +80,7 @@ class LogReader(object):
"""
Get a image reader with tag
"""
check_tag_name_valid
(
tag
)
return
self
.
reader
.
get_image
(
tag
)
def
histogram
(
self
,
tag
,
type
=
'float'
):
...
...
@@ -82,6 +92,7 @@ class LogReader(object):
'double'
:
self
.
reader
.
get_histogram_double
,
'int'
:
self
.
reader
.
get_histogram_int
,
}
check_tag_name_valid
(
tag
)
return
type2scalar
[
type
](
tag
)
def
__enter__
(
self
):
...
...
@@ -105,6 +116,7 @@ class LogWriter(object):
self
.
writer
=
writer
if
writer
else
core
.
LogWriter
(
dir
,
sync_cycle
)
def
mode
(
self
,
mode
):
check_mode_name_valid
(
mode
)
self
.
writer
.
set_mode
(
mode
)
return
self
...
...
@@ -112,6 +124,7 @@ class LogWriter(object):
"""
create a new LogWriter with mode and return it.
"""
check_mode_name_valid
(
mode
)
LogWriter
.
cur_mode
=
LogWriter
(
self
.
dir
,
self
.
sync_cycle
,
self
.
writer
.
as_mode
(
mode
))
return
LogWriter
.
cur_mode
...
...
@@ -119,6 +132,7 @@ class LogWriter(object):
"""
Create a scalar writer with tag and type to write scalar data.
"""
check_tag_name_valid
(
tag
)
type2scalar
=
{
'float'
:
self
.
writer
.
new_scalar_float
,
'double'
:
self
.
writer
.
new_scalar_double
,
...
...
@@ -130,6 +144,7 @@ class LogWriter(object):
"""
Create an image writer that used to write image data.
"""
check_tag_name_valid
(
tag
)
return
self
.
writer
.
new_image
(
tag
,
num_samples
,
step_cycle
)
def
histogram
(
self
,
tag
,
num_buckets
,
type
=
'float'
):
...
...
@@ -137,6 +152,7 @@ class LogWriter(object):
Create a histogram writer that used to write
histogram related data.
"""
check_tag_name_valid
(
tag
)
types
=
{
'float'
:
self
.
writer
.
new_histogram_float
,
'double'
:
self
.
writer
.
new_histogram_double
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录