Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
42c327c4
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看板
未验证
提交
42c327c4
编写于
1月 14, 2018
作者:
Y
Yan Chunwei
提交者:
GitHub
1月 14, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enhance/image binary record use sampling (#132)
上级
9867588d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
18 deletion
+32
-18
visualdl/logic/sdk.cc
visualdl/logic/sdk.cc
+11
-0
visualdl/server/lib_test.py
visualdl/server/lib_test.py
+3
-3
visualdl/storage/entry.h
visualdl/storage/entry.h
+18
-15
未找到文件。
visualdl/logic/sdk.cc
浏览文件 @
42c327c4
#include "visualdl/logic/sdk.h"
#include <cstdio>
#include "visualdl/logic/histogram.h"
#include "visualdl/storage/binary_record.h"
#include "visualdl/utils/image.h"
#include "visualdl/utils/logging.h"
#include "visualdl/utils/macro.h"
namespace
visualdl
{
...
...
@@ -202,6 +205,14 @@ void Image::SetSample(int index,
brcd
.
tofile
();
auto
entry
=
step_
.
MutableData
<
std
::
vector
<
byte_t
>>
(
index
);
// update record
auto
old_hash
=
entry
.
reader
().
GetRaw
();
if
(
!
old_hash
.
empty
())
{
std
::
string
old_path
=
GenBinaryRecordDir
(
step_
.
parent
()
->
dir
())
+
"/"
+
old_hash
;
CHECK_EQ
(
std
::
remove
(
old_path
.
c_str
()),
0
)
<<
"delete old binary record "
<<
old_path
<<
" failed"
;
}
entry
.
SetRaw
(
brcd
.
hash
());
static_assert
(
...
...
visualdl/server/lib_test.py
浏览文件 @
42c327c4
...
...
@@ -2,7 +2,7 @@ import pprint
import
unittest
import
lib
import
storage
from
visualdl
import
LogReader
,
LogWriter
import
pprint
from
storage_mock
import
add_scalar
,
add_image
,
add_histogram
...
...
@@ -11,7 +11,7 @@ from storage_mock import add_scalar, add_image, add_histogram
class
LibTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
dir
=
"./tmp/mock"
writer
=
storage
.
LogWriter
(
dir
,
sync_cycle
=
10
)
writer
=
LogWriter
(
dir
,
sync_cycle
=
10
)
add_scalar
(
writer
,
"train"
,
"layer/scalar0/min"
,
1000
,
1
)
add_scalar
(
writer
,
"test"
,
"layer/scalar0/min"
,
1000
,
10
)
...
...
@@ -30,7 +30,7 @@ class LibTest(unittest.TestCase):
add_histogram
(
writer
,
"train"
,
"layer/histogram0"
,
100
)
add_histogram
(
writer
,
"test"
,
"layer/histogram0"
,
100
)
self
.
reader
=
storage
.
LogReader
(
dir
)
self
.
reader
=
LogReader
(
dir
)
def
test_modes
(
self
):
modes
=
lib
.
get_modes
(
self
.
reader
)
...
...
visualdl/storage/entry.h
浏览文件 @
42c327c4
...
...
@@ -11,6 +11,21 @@ struct Storage;
using
byte_t
=
unsigned
char
;
struct
EntryReader
{
EntryReader
(
storage
::
Entry
x
)
:
data_
(
x
)
{}
// Get a single value.
template
<
typename
T
>
T
Get
()
const
;
// Get repeated field.
template
<
typename
T
>
std
::
vector
<
T
>
GetMulti
()
const
;
std
::
string
GetRaw
()
{
return
data_
.
y
();
}
private:
storage
::
Entry
data_
;
};
/*
* Utility helper for storage::Entry.
*/
...
...
@@ -44,23 +59,11 @@ struct Entry {
Storage
*
parent
()
{
return
x_
;
}
void
set_parent
(
Storage
*
x
)
{
x_
=
x
;
}
private:
Storage
*
x_
;
};
struct
EntryReader
{
EntryReader
(
storage
::
Entry
x
)
:
data_
(
x
)
{}
// Get a single value.
template
<
typename
T
>
T
Get
()
const
;
// Get repeated field.
template
<
typename
T
>
std
::
vector
<
T
>
GetMulti
()
const
;
std
::
string
GetRaw
()
{
return
data_
.
y
();
}
// TODO(ChunweiYan) avoid copy.
EntryReader
reader
()
{
return
EntryReader
(
*
entry
);
}
private:
storage
::
Entry
data
_
;
Storage
*
x
_
;
};
}
// namespace visualdl
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录