Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
2dd3de5d
V
VisualDL
项目概览
PaddlePaddle
/
VisualDL
大约 1 年 前同步成功
通知
86
Star
4655
Fork
641
代码
文件
提交
分支
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2dd3de5d
编写于
2月 03, 2018
作者:
J
Jeff Wang
提交者:
daminglu
2月 03, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update the documentation description in the storage.py (#251)
上级
ca59c51a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
48 addition
and
9 deletion
+48
-9
visualdl/python/storage.py
visualdl/python/storage.py
+48
-9
未找到文件。
visualdl/python/storage.py
浏览文件 @
2dd3de5d
...
...
@@ -16,7 +16,7 @@ def check_mode_name_valid(tag):
class
LogReader
(
object
):
"""LogReader is a Python wrapper to read and analysis the data that
saved with data format defined in storage.proto.
u
ser can get
saved with data format defined in storage.proto.
A U
ser can get
Scalar Reader/Image Reader/Histogram Reader from this module and use
them to reade the data you need.
"""
...
...
@@ -34,11 +34,10 @@ class LogReader(object):
"""
Set the current mode of reader.
:param mode: the mode is something like a scope, it's used to
put some related data together. for example: train or test.
data generated during training can be marked mode train, and data
generated during testing can be marked test.
:return: the reader itself
:param mode: The log reader will read the data grouped by mode.
:type mode: basestring
:return: the log reader itself
:rtype: LogReader
"""
check_mode_name_valid
(
mode
)
self
.
reader
.
set_mode
(
mode
)
...
...
@@ -47,6 +46,11 @@ class LogReader(object):
def
as_mode
(
self
,
mode
):
"""
create a new LogReader with mode and return it to user.
:param mode: The log reader will read the data grouped by mode.
:type mode: basestring
:return: a new log reader instance
:rtype: LogReader
"""
check_mode_name_valid
(
mode
)
tmp
=
LogReader
(
dir
,
self
.
reader
.
as_mode
(
mode
))
...
...
@@ -55,21 +59,28 @@ class LogReader(object):
def
modes
(
self
):
"""
Get all modes of the log file
:return:
:return: a list of all modes
:rtype: list
"""
return
self
.
reader
.
modes
()
def
tags
(
self
,
component
):
"""
Get all tags from the current log file for one kind of component
:param component: Scalar|Histogram|Images
:param component: scalar|histogram|image
:return: all the tags
:type: list
"""
return
self
.
reader
.
tags
(
component
)
def
scalar
(
self
,
tag
,
type
=
'float'
):
"""
Get a scalar reader with tag and data type
:param tag: The reader will read the scalar data marked with tag
:type tag: basestring
"""
check_tag_name_valid
(
tag
)
type2scalar
=
{
...
...
@@ -82,6 +93,9 @@ class LogReader(object):
def
image
(
self
,
tag
):
"""
Get a image reader with tag
:param tag: The reader will read the image data marked with tag
:type tag: basestring
"""
check_tag_name_valid
(
tag
)
return
self
.
reader
.
get_image
(
tag
)
...
...
@@ -89,6 +103,9 @@ class LogReader(object):
def
histogram
(
self
,
tag
,
type
=
'float'
):
"""
Get a histogram reader with tag and data type
:param tag: The reader will read the histogram data marked with tag
:type tag: basestring
"""
type2scalar
=
{
'float'
:
self
.
reader
.
get_histogram_float
,
...
...
@@ -107,7 +124,7 @@ class LogReader(object):
class
LogWriter
(
object
):
"""LogWriter is a Python wrapper to write data to log file with the data
format defined in storage.proto.
u
ser can get Scalar Reader/Image Reader/
format defined in storage.proto.
A U
ser can get Scalar Reader/Image Reader/
Histogram Reader from this module and use them to write the data to log file.
"""
...
...
@@ -119,6 +136,14 @@ class LogWriter(object):
self
.
writer
=
writer
if
writer
else
core
.
LogWriter
(
dir
,
sync_cycle
)
def
mode
(
self
,
mode
):
"""
Set the current mode of writer.
:param mode: The logger will group data under mode.
:type mode: basestring
:return: a new LogWriter instance with mode
:rtype: LogWriter
"""
check_mode_name_valid
(
mode
)
self
.
writer
.
set_mode
(
mode
)
return
self
...
...
@@ -126,6 +151,11 @@ class LogWriter(object):
def
as_mode
(
self
,
mode
):
"""
create a new LogWriter with mode and return it.
:param mode: The logger will group data under mode.
:type mode: basestring
:return: the logWriter itself
:rtype: LogWriter
"""
check_mode_name_valid
(
mode
)
LogWriter
.
cur_mode
=
LogWriter
(
self
.
dir
,
self
.
sync_cycle
,
...
...
@@ -135,6 +165,9 @@ class LogWriter(object):
def
scalar
(
self
,
tag
,
type
=
'float'
):
"""
Create a scalar writer with tag and type to write scalar data.
:param tag: The scalar writer will label the data with tag
:type tag: basestring
"""
check_tag_name_valid
(
tag
)
type2scalar
=
{
...
...
@@ -147,6 +180,9 @@ class LogWriter(object):
def
image
(
self
,
tag
,
num_samples
,
step_cycle
=
1
):
"""
Create an image writer that used to write image data.
:param tag: The image writer will label the image with tag
:type tag: basestring
"""
check_tag_name_valid
(
tag
)
return
self
.
writer
.
new_image
(
tag
,
num_samples
,
step_cycle
)
...
...
@@ -155,6 +191,9 @@ class LogWriter(object):
"""
Create a histogram writer that used to write
histogram related data.
:param tag: The histogram writer will label the data with tag
:type tag: basestring
"""
check_tag_name_valid
(
tag
)
types
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录