Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
b05a8dd0
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看板
提交
b05a8dd0
编写于
12月 25, 2017
作者:
S
superjom
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code clean
上级
c65bf61b
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
61 addition
and
114 deletion
+61
-114
CMakeLists.txt
CMakeLists.txt
+0
-1
tests.sh
tests.sh
+0
-13
visualdl/logic/im.cc
visualdl/logic/im.cc
+6
-0
visualdl/logic/pybind.cc
visualdl/logic/pybind.cc
+2
-3
visualdl/logic/sdk.cc
visualdl/logic/sdk.cc
+42
-55
visualdl/logic/sdk.h
visualdl/logic/sdk.h
+0
-37
visualdl/python/CMakeLists.txt
visualdl/python/CMakeLists.txt
+1
-1
visualdl/python/test_storage.py
visualdl/python/test_storage.py
+7
-1
visualdl/storage/CMakeLists.txt
visualdl/storage/CMakeLists.txt
+1
-1
visualdl/storage/entry.cc
visualdl/storage/entry.cc
+1
-1
visualdl/storage/entry.h
visualdl/storage/entry.h
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
b05a8dd0
...
@@ -49,4 +49,3 @@ enable_testing ()
...
@@ -49,4 +49,3 @@ enable_testing ()
add_custom_target
(
test_init COMMAND $CMAKE_BINARY_DIR
)
add_custom_target
(
test_init COMMAND $CMAKE_BINARY_DIR
)
add_test
(
NAME vstest COMMAND ./vl_test
)
add_test
(
NAME vstest COMMAND ./vl_test
)
set_target_properties
(
vl_test PROPERTIES DEPENDS test_init
)
tests.sh
已删除
100644 → 0
浏览文件 @
c65bf61b
#!/bin/bash
set
-ex
sudo
pip
install
numpy
#sudo apt-get install --only-upgrade cmake -y
mkdir
-p
build
cd
build
cmake ..
make
make
test
#if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./travis/run_on_pull_requests; fi
#if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./travis/run_on_non_pull_requests; fi
visualdl/logic/im.cc
浏览文件 @
b05a8dd0
...
@@ -32,5 +32,11 @@ void SimpleWriteSyncGuard<T>::Sync() {
...
@@ -32,5 +32,11 @@ void SimpleWriteSyncGuard<T>::Sync() {
template
class
SimpleWriteSyncGuard
<
Storage
>;
template
class
SimpleWriteSyncGuard
<
Storage
>;
template
class
SimpleWriteSyncGuard
<
Tablet
>;
template
class
SimpleWriteSyncGuard
<
Tablet
>;
template
class
SimpleWriteSyncGuard
<
Record
>;
template
class
SimpleWriteSyncGuard
<
Record
>;
template
class
SimpleWriteSyncGuard
<
Entry
<
float
>
>
;
template
class
SimpleWriteSyncGuard
<
Entry
<
double
>
>
;
template
class
SimpleWriteSyncGuard
<
Entry
<
bool
>
>
;
template
class
SimpleWriteSyncGuard
<
Entry
<
long
>
>
;
template
class
SimpleWriteSyncGuard
<
Entry
<
std
::
string
>
>
;
template
class
SimpleWriteSyncGuard
<
Entry
<
int
>
>
;
}
// namespace visualdl
}
// namespace visualdl
visualdl/logic/pybind.cc
浏览文件 @
b05a8dd0
...
@@ -15,6 +15,7 @@ PYBIND11_PLUGIN(core) {
...
@@ -15,6 +15,7 @@ PYBIND11_PLUGIN(core) {
py::class_<cp::ScalarReader<T>>(m, "ScalarReader__" #T) \
py::class_<cp::ScalarReader<T>>(m, "ScalarReader__" #T) \
.def("records", &cp::ScalarReader<T>::records) \
.def("records", &cp::ScalarReader<T>::records) \
.def("timestamps", &cp::ScalarReader<T>::timestamps) \
.def("timestamps", &cp::ScalarReader<T>::timestamps) \
.def("ids", &cp::ScalarReader<T>::ids) \
.def("caption", &cp::ScalarReader<T>::caption);
.def("caption", &cp::ScalarReader<T>::caption);
ADD_SCALAR
(
int
);
ADD_SCALAR
(
int
);
ADD_SCALAR
(
float
);
ADD_SCALAR
(
float
);
...
@@ -57,9 +58,7 @@ PYBIND11_PLUGIN(core) {
...
@@ -57,9 +58,7 @@ PYBIND11_PLUGIN(core) {
py
::
class_
<
vs
::
Writer
>
(
m
,
"Writer"
)
py
::
class_
<
vs
::
Writer
>
(
m
,
"Writer"
)
.
def
(
"__init__"
,
.
def
(
"__init__"
,
[](
vs
::
Writer
&
instance
,
[](
vs
::
Writer
&
instance
,
const
std
::
string
&
dir
,
int
sync_cycle
)
{
const
std
::
string
&
dir
,
int
sync_cycle
)
{
new
(
&
instance
)
vs
::
Writer
(
dir
);
new
(
&
instance
)
vs
::
Writer
(
dir
);
instance
.
storage
().
meta
.
cycle
=
sync_cycle
;
instance
.
storage
().
meta
.
cycle
=
sync_cycle
;
})
})
...
...
visualdl/logic/sdk.cc
浏览文件 @
b05a8dd0
...
@@ -4,61 +4,48 @@ namespace visualdl {
...
@@ -4,61 +4,48 @@ namespace visualdl {
namespace
components
{
namespace
components
{
// template <typename T>
template
<
typename
T
>
// void components::Scalar<T>::AddRecord(int id, const std::vector<T> &values) {
std
::
vector
<
T
>
ScalarReader
<
T
>::
records
()
const
{
// // add record data
std
::
vector
<
T
>
res
;
// auto record = tablet_.AddRecord();
for
(
int
i
=
0
;
i
<
reader_
.
total_records
();
i
++
)
{
// auto entry = record.AddData<T>();
res
.
push_back
(
reader_
.
record
(
i
).
data
<
T
>
(
0
).
Get
());
// for (auto v : values) {
}
// entry.Add(v);
return
res
;
// }
}
// // set record id
// record.SetId(id);
template
<
typename
T
>
// // set record timestamp
std
::
vector
<
T
>
ScalarReader
<
T
>::
ids
()
const
{
// record.SetTimeStamp(time(NULL));
std
::
vector
<
T
>
res
;
// }
for
(
int
i
=
0
;
i
<
reader_
.
total_records
();
i
++
)
{
res
.
push_back
(
reader_
.
record
(
i
).
id
());
// template <typename T>
}
// std::vector<T> ScalarReader<T>::records() const {
return
res
;
// std::vector<T> res;
}
// for (int i = 0; i < reader_.total_records(); i++) {
// res.push_back(reader_.record(i).data<T>(0));
template
<
typename
T
>
// }
std
::
vector
<
T
>
ScalarReader
<
T
>::
timestamps
()
const
{
// return res;
std
::
vector
<
T
>
res
;
// }
for
(
int
i
=
0
;
i
<
reader_
.
total_records
();
i
++
)
{
res
.
push_back
(
reader_
.
record
(
i
).
timestamp
());
// template <typename T>
}
// std::vector<int> ScalarReader<T>::ids() const {
return
res
;
// std::vector<int> res;
}
// for (int i = 0; i < reader_.total_records(); i++) {
// res.push_back(reader_.record(i).id());
template
<
typename
T
>
// }
std
::
string
ScalarReader
<
T
>::
caption
()
const
{
// return res;
CHECK
(
!
reader_
.
captions
().
empty
())
<<
"no caption"
;
// }
return
reader_
.
captions
().
front
();
}
// template <typename T>
// std::vector<int> ScalarReader<T>::timestamps() const {
template
<
typename
T
>
// std::vector<T> res;
size_t
ScalarReader
<
T
>::
size
()
const
{
// for (int i = 0; i < reader_.total_records(); i++) {
return
reader_
.
total_records
();
// res.push_back(reader_.record(i).timestamp());
}
// }
// return res;
template
class
ScalarReader
<
int
>;
// }
template
class
ScalarReader
<
int64_t
>;
template
class
ScalarReader
<
float
>;
// template <typename T>
template
class
ScalarReader
<
double
>;
// std::vector<std::string> ScalarReader<T>::captions() const {
// return reader_.captions();
// }
// template <typename T>
// size_t ScalarReader<T>::size() const {
// return reader_.total_records();
// }
// template class Scalar<int>;
// template class Scalar<int64_t>;
// template class Scalar<float>;
// template class Scalar<double>;
}
// namespace components
}
// namespace components
...
...
visualdl/logic/sdk.h
浏览文件 @
b05a8dd0
...
@@ -91,43 +91,6 @@ private:
...
@@ -91,43 +91,6 @@ private:
TabletReader
reader_
;
TabletReader
reader_
;
};
};
template
<
typename
T
>
std
::
vector
<
T
>
ScalarReader
<
T
>::
records
()
const
{
std
::
vector
<
T
>
res
;
for
(
int
i
=
0
;
i
<
reader_
.
total_records
();
i
++
)
{
res
.
push_back
(
reader_
.
record
(
i
).
data
<
T
>
(
0
).
Get
());
}
return
res
;
}
template
<
typename
T
>
std
::
vector
<
T
>
ScalarReader
<
T
>::
ids
()
const
{
std
::
vector
<
T
>
res
;
for
(
int
i
=
0
;
i
<
reader_
.
total_records
();
i
++
)
{
res
.
push_back
(
reader_
.
record
(
i
).
id
());
}
return
res
;
}
template
<
typename
T
>
std
::
vector
<
T
>
ScalarReader
<
T
>::
timestamps
()
const
{
std
::
vector
<
T
>
res
;
for
(
int
i
=
0
;
i
<
reader_
.
total_records
();
i
++
)
{
res
.
push_back
(
reader_
.
record
(
i
).
timestamp
());
}
return
res
;
}
template
<
typename
T
>
std
::
string
ScalarReader
<
T
>::
caption
()
const
{
CHECK
(
!
reader_
.
captions
().
empty
())
<<
"no caption"
;
return
reader_
.
captions
().
front
();
}
template
<
typename
T
>
size_t
ScalarReader
<
T
>::
size
()
const
{
return
reader_
.
total_records
();
}
}
// namespace components
}
// namespace components
}
// namespace visualdl
}
// namespace visualdl
...
...
visualdl/python/CMakeLists.txt
浏览文件 @
b05a8dd0
...
@@ -10,4 +10,4 @@ function(py_test TARGET_NAME)
...
@@ -10,4 +10,4 @@ function(py_test TARGET_NAME)
)
)
endfunction
()
endfunction
()
py_test
(
test_summary SRCS test_s
ummary
.py
)
py_test
(
test_summary SRCS test_s
torage
.py
)
visualdl/python/test_s
ummary
.py
→
visualdl/python/test_s
torage
.py
浏览文件 @
b05a8dd0
...
@@ -14,12 +14,18 @@ class StorageTest(unittest.TestCase):
...
@@ -14,12 +14,18 @@ class StorageTest(unittest.TestCase):
scalar
=
self
.
writer
.
scalar
(
"model/scalar/min"
)
scalar
=
self
.
writer
.
scalar
(
"model/scalar/min"
)
# scalar.set_caption("model/scalar/min")
# scalar.set_caption("model/scalar/min")
for
i
in
range
(
10
):
for
i
in
range
(
10
):
scalar
.
add_record
(
i
,
1.0
)
scalar
.
add_record
(
i
,
float
(
i
)
)
print
'test read'
print
'test read'
self
.
reader
=
storage
.
StorageReader
(
"train"
,
self
.
dir
)
self
.
reader
=
storage
.
StorageReader
(
"train"
,
self
.
dir
)
scalar
=
self
.
reader
.
scalar
(
"model/scalar/min"
)
scalar
=
self
.
reader
.
scalar
(
"model/scalar/min"
)
self
.
assertEqual
(
scalar
.
caption
(),
"train"
)
self
.
assertEqual
(
scalar
.
caption
(),
"train"
)
records
=
scalar
.
records
()
ids
=
scalar
.
ids
()
self
.
assertTrue
(
np
.
equal
(
records
,
[
float
(
i
)
for
i
in
range
(
10
)]).
all
())
self
.
assertTrue
(
np
.
equal
(
ids
,
[
float
(
i
)
for
i
in
range
(
10
)]).
all
())
print
'records'
,
records
print
'ids'
,
ids
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
visualdl/storage/CMakeLists.txt
浏览文件 @
b05a8dd0
...
@@ -9,7 +9,7 @@ add_library(tablet tablet.cc tablet.h ${PROTO_SRCS} ${PROTO_HDRS})
...
@@ -9,7 +9,7 @@ add_library(tablet tablet.cc tablet.h ${PROTO_SRCS} ${PROTO_HDRS})
add_library
(
record record.cc record.h
${
PROTO_SRCS
}
${
PROTO_HDRS
}
)
add_library
(
record record.cc record.h
${
PROTO_SRCS
}
${
PROTO_HDRS
}
)
add_library
(
storage storage.cc storage.h
${
PROTO_SRCS
}
${
PROTO_HDRS
}
)
add_library
(
storage storage.cc storage.h
${
PROTO_SRCS
}
${
PROTO_HDRS
}
)
add_dependencies
(
entry storage_proto
)
add_dependencies
(
entry storage_proto
im
)
add_dependencies
(
record storage_proto entry
)
add_dependencies
(
record storage_proto entry
)
add_dependencies
(
tablet storage_proto
)
add_dependencies
(
tablet storage_proto
)
add_dependencies
(
storage storage_proto
)
add_dependencies
(
storage storage_proto
)
visualdl/storage/entry.cc
浏览文件 @
b05a8dd0
...
@@ -7,6 +7,7 @@ namespace visualdl {
...
@@ -7,6 +7,7 @@ namespace visualdl {
void Entry<ctype__>::method__(ctype__ v) { \
void Entry<ctype__>::method__(ctype__ v) { \
entry->set_dtype(storage::DataType::dtype__); \
entry->set_dtype(storage::DataType::dtype__); \
entry->opr__(v); \
entry->opr__(v); \
WRITE_GUARD \
}
}
IMPL_ENTRY_SET_OR_ADD
(
Set
,
int
,
kInt32
,
set_i32
);
IMPL_ENTRY_SET_OR_ADD
(
Set
,
int
,
kInt32
,
set_i32
);
...
@@ -57,5 +58,4 @@ template class EntryReader<float>;
...
@@ -57,5 +58,4 @@ template class EntryReader<float>;
template
class
EntryReader
<
double
>;
template
class
EntryReader
<
double
>;
template
class
EntryReader
<
bool
>;
template
class
EntryReader
<
bool
>;
}
// namespace visualdl
}
// namespace visualdl
visualdl/storage/entry.h
浏览文件 @
b05a8dd0
...
@@ -14,7 +14,7 @@ struct Storage;
...
@@ -14,7 +14,7 @@ struct Storage;
*/
*/
template
<
typename
T
>
template
<
typename
T
>
struct
Entry
{
struct
Entry
{
DECL_GUARD
(
Entry
)
DECL_GUARD
(
Entry
<
T
>
)
// use pointer to avoid copy
// use pointer to avoid copy
storage
::
Entry
*
entry
{
nullptr
};
storage
::
Entry
*
entry
{
nullptr
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录