Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
bcb46f55
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
bcb46f55
编写于
4月 06, 2018
作者:
L
Lei Wang
提交者:
GitHub
4月 06, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9688 from wangkuiyi/cpplint-recordio
Fix cpplint errors with paddle/fluid/recordio
上级
b2a1c9e8
c839ec6c
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
35 addition
and
19 deletion
+35
-19
cmake/external/snappystream.cmake
cmake/external/snappystream.cmake
+3
-1
cmake/external/zlib.cmake
cmake/external/zlib.cmake
+2
-1
paddle/fluid/recordio/chunk.cc
paddle/fluid/recordio/chunk.cc
+4
-2
paddle/fluid/recordio/chunk_test.cc
paddle/fluid/recordio/chunk_test.cc
+5
-7
paddle/fluid/recordio/header_test.cc
paddle/fluid/recordio/header_test.cc
+2
-4
paddle/fluid/recordio/scanner.cc
paddle/fluid/recordio/scanner.cc
+4
-0
paddle/fluid/recordio/scanner.h
paddle/fluid/recordio/scanner.h
+3
-0
paddle/fluid/recordio/writer.cc
paddle/fluid/recordio/writer.cc
+5
-0
paddle/fluid/recordio/writer.h
paddle/fluid/recordio/writer.h
+3
-1
paddle/fluid/recordio/writer_scanner_test.cc
paddle/fluid/recordio/writer_scanner_test.cc
+4
-3
未找到文件。
cmake/external/snappystream.cmake
浏览文件 @
bcb46f55
...
...
@@ -54,5 +54,7 @@ add_library(snappystream STATIC IMPORTED GLOBAL)
set_property
(
TARGET snappystream PROPERTY IMPORTED_LOCATION
"
${
SNAPPYSTREAM_INSTALL_DIR
}
/lib/libsnappystream.a"
)
include_directories
(
${
SNAPPYSTREAM_INCLUDE_DIR
}
)
include_directories
(
${
SNAPPYSTREAM_INCLUDE_DIR
}
)
# For snappysteam to include its own headers.
include_directories
(
${
THIRD_PARTY_PATH
}
/install
)
# For Paddle to include snappy stream headers.
add_dependencies
(
snappystream extern_snappystream
)
cmake/external/zlib.cmake
浏览文件 @
bcb46f55
...
...
@@ -25,7 +25,8 @@ ELSE(WIN32)
SET
(
ZLIB_LIBRARIES
"
${
ZLIB_INSTALL_DIR
}
/lib/libz.a"
CACHE FILEPATH
"zlib library."
FORCE
)
ENDIF
(
WIN32
)
INCLUDE_DIRECTORIES
(
${
ZLIB_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
ZLIB_INCLUDE_DIR
}
)
# For zlib code to include its own headers.
INCLUDE_DIRECTORIES
(
${
THIRD_PARTY_PATH
}
/install
)
# For Paddle code to include zlib.h.
ExternalProject_Add
(
extern_zlib
...
...
paddle/fluid/recordio/chunk.cc
浏览文件 @
bcb46f55
...
...
@@ -14,11 +14,13 @@
#include "paddle/fluid/recordio/chunk.h"
#include <algorithm>
#include <memory>
#include <sstream>
#include "paddle/fluid/platform/enforce.h"
#include "snappystream.hpp"
#include "zlib.h"
#include "snappy
_stream/include/snappy
stream.hpp"
#include "zlib
/include/zlib
.h"
namespace
paddle
{
namespace
recordio
{
...
...
paddle/fluid/recordio/chunk_test.cc
浏览文件 @
bcb46f55
...
...
@@ -18,29 +18,27 @@
#include "gtest/gtest.h"
using
namespace
paddle
::
recordio
;
TEST
(
Chunk
,
SaveLoad
)
{
Chunk
ch
;
paddle
::
recordio
::
Chunk
ch
;
ch
.
Add
(
std
::
string
(
"12345"
,
6
));
ch
.
Add
(
std
::
string
(
"123"
,
4
));
std
::
stringstream
ss
;
ch
.
Write
(
ss
,
Compressor
::
kNoCompress
);
ch
.
Write
(
ss
,
paddle
::
recordio
::
Compressor
::
kNoCompress
);
ss
.
seekg
(
0
);
ch
.
Parse
(
ss
);
ASSERT_EQ
(
ch
.
NumBytes
(),
10U
);
}
TEST
(
Chunk
,
Compressor
)
{
Chunk
ch
;
paddle
::
recordio
::
Chunk
ch
;
ch
.
Add
(
std
::
string
(
"12345"
,
6
));
ch
.
Add
(
std
::
string
(
"123"
,
4
));
ch
.
Add
(
std
::
string
(
"123"
,
4
));
ch
.
Add
(
std
::
string
(
"123"
,
4
));
std
::
stringstream
ss
;
ch
.
Write
(
ss
,
Compressor
::
kSnappy
);
ch
.
Write
(
ss
,
paddle
::
recordio
::
Compressor
::
kSnappy
);
std
::
stringstream
ss2
;
ch
.
Write
(
ss2
,
Compressor
::
kNoCompress
);
ch
.
Write
(
ss2
,
paddle
::
recordio
::
Compressor
::
kNoCompress
);
ASSERT_LE
(
ss
.
tellp
(),
ss2
.
tellp
());
// Compress should contain less data;
ch
.
Clear
();
...
...
paddle/fluid/recordio/header_test.cc
浏览文件 @
bcb46f55
...
...
@@ -18,14 +18,12 @@
#include "gtest/gtest.h"
using
namespace
paddle
::
recordio
;
TEST
(
Recordio
,
ChunkHead
)
{
Header
hdr
(
0
,
1
,
Compressor
::
kGzip
,
3
);
paddle
::
recordio
::
Header
hdr
(
0
,
1
,
paddle
::
recordio
::
Compressor
::
kGzip
,
3
);
std
::
stringstream
ss
;
hdr
.
Write
(
ss
);
ss
.
seekg
(
0
,
std
::
ios
::
beg
);
Header
hdr2
;
paddle
::
recordio
::
Header
hdr2
;
hdr2
.
Parse
(
ss
);
EXPECT_TRUE
(
hdr
==
hdr2
);
}
paddle/fluid/recordio/scanner.cc
浏览文件 @
bcb46f55
...
...
@@ -13,10 +13,14 @@
// limitations under the License.
#include "paddle/fluid/recordio/scanner.h"
#include <string>
#include "paddle/fluid/platform/enforce.h"
namespace
paddle
{
namespace
recordio
{
Scanner
::
Scanner
(
std
::
unique_ptr
<
std
::
istream
>
&&
stream
)
:
stream_
(
std
::
move
(
stream
))
{
Reset
();
...
...
paddle/fluid/recordio/scanner.h
浏览文件 @
bcb46f55
...
...
@@ -16,7 +16,10 @@
#include <fstream>
#include <memory>
#include <string>
#include "paddle/fluid/recordio/chunk.h"
namespace
paddle
{
namespace
recordio
{
...
...
paddle/fluid/recordio/writer.cc
浏览文件 @
bcb46f55
...
...
@@ -12,9 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/fluid/recordio/writer.h"
#include <string>
#include "paddle/fluid/platform/enforce.h"
namespace
paddle
{
namespace
recordio
{
void
Writer
::
Write
(
const
std
::
string
&
record
)
{
cur_chunk_
.
Add
(
record
);
if
(
cur_chunk_
.
NumRecords
()
>=
max_num_records_in_chunk_
)
{
...
...
paddle/fluid/recordio/writer.h
浏览文件 @
bcb46f55
...
...
@@ -11,8 +11,10 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <string>
#include "paddle/fluid/recordio/chunk.h"
namespace
paddle
{
namespace
recordio
{
...
...
paddle/fluid/recordio/writer_scanner_test.cc
浏览文件 @
bcb46f55
...
...
@@ -12,9 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "gtest/gtest.h"
#include <sstream>
#include <string>
#include "gtest/gtest.h"
#include "paddle/fluid/recordio/scanner.h"
#include "paddle/fluid/recordio/writer.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录