Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
7c194acc
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
7c194acc
编写于
4月 20, 2018
作者:
F
fengjiayi
提交者:
GitHub
4月 20, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9929 from JiayiFeng/make_for_parallel_default_true
make for_parallel default True
上级
f7386917
c6fc6a36
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
11 deletion
+13
-11
python/paddle/fluid/layers/io.py
python/paddle/fluid/layers/io.py
+8
-3
python/paddle/fluid/tests/unittests/test_multi_file_reader.py
...on/paddle/fluid/tests/unittests/test_multi_file_reader.py
+0
-1
python/paddle/fluid/tests/unittests/test_multi_pass_reader.py
...on/paddle/fluid/tests/unittests/test_multi_pass_reader.py
+2
-4
python/paddle/fluid/tests/unittests/test_recordio_reader.py
python/paddle/fluid/tests/unittests/test_recordio_reader.py
+3
-3
未找到文件。
python/paddle/fluid/layers/io.py
浏览文件 @
7c194acc
...
...
@@ -21,7 +21,7 @@ from ..executor import global_scope
__all__
=
[
'data'
,
'BlockGuardServ'
,
'ListenAndServ'
,
'Send'
,
'open_recordio_file'
,
'open_files'
,
'read_file'
,
'shuffle'
,
'double_buffer'
'open_files'
,
'read_file'
,
'shuffle'
,
'
batch'
,
'
double_buffer'
]
...
...
@@ -290,7 +290,7 @@ def open_recordio_file(filename,
lod_levels
,
dtypes
,
pass_num
=
1
,
for_parallel
=
Fals
e
):
for_parallel
=
Tru
e
):
"""
Open a RecordIO file
...
...
@@ -364,7 +364,7 @@ def open_files(filenames,
thread_num
,
buffer_size
=
None
,
pass_num
=
1
,
for_parallel
=
Fals
e
):
for_parallel
=
Tru
e
):
"""
Open files
...
...
@@ -476,6 +476,11 @@ def shuffle(reader, buffer_size):
'create_shuffle_reader'
,
reader
,
{
'buffer_size'
:
int
(
buffer_size
)})
def
batch
(
reader
,
batch_size
):
return
__create_unshared_decorated_reader__
(
'create_batch_reader'
,
reader
,
{
'batch_size'
:
int
(
batch_size
)})
def
double_buffer
(
reader
,
place
=
None
):
attrs
=
dict
()
if
place
is
not
None
:
...
...
python/paddle/fluid/tests/unittests/test_multi_file_reader.py
浏览文件 @
7c194acc
...
...
@@ -69,7 +69,6 @@ class TestMultipleReader(unittest.TestCase):
break
batch_count
+=
1
self
.
assertLessEqual
(
img_val
.
shape
[
0
],
self
.
batch_size
)
data_files
.
reset
()
self
.
assertEqual
(
batch_count
,
self
.
num_batch
*
3
)
def
test_main
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_multi_pass_reader.py
浏览文件 @
7c194acc
...
...
@@ -43,9 +43,8 @@ class TestMultipleReader(unittest.TestCase):
filename
=
'./mnist.recordio'
,
shapes
=
[(
-
1
,
784
),
(
-
1
,
1
)],
lod_levels
=
[
0
,
0
],
dtypes
=
[
'float32'
,
'int64'
])
data_file
=
fluid
.
layers
.
io
.
multi_pass
(
reader
=
data_file
,
pass_num
=
self
.
pass_num
)
dtypes
=
[
'float32'
,
'int64'
],
pass_num
=
self
.
pass_num
)
img
,
label
=
fluid
.
layers
.
read_file
(
data_file
)
if
fluid
.
core
.
is_compiled_with_cuda
():
...
...
@@ -65,5 +64,4 @@ class TestMultipleReader(unittest.TestCase):
break
batch_count
+=
1
self
.
assertLessEqual
(
img_val
.
shape
[
0
],
self
.
batch_size
)
data_file
.
reset
()
self
.
assertEqual
(
batch_count
,
self
.
num_batch
*
self
.
pass_num
)
python/paddle/fluid/tests/unittests/test_recordio_reader.py
浏览文件 @
7c194acc
...
...
@@ -74,13 +74,13 @@ class TestRecordIO(unittest.TestCase):
avg_loss_np
.
append
(
tmp
)
batch_id
+=
1
data_file
.
reset
()
self
.
assertEqual
(
batch_id
,
self
.
num_batches
)
self
.
assertLess
(
avg_loss_np
[
-
1
],
avg_loss_np
[
0
])
def
test_shuffle_reader
(
self
):
self
.
test_main
(
decorator_callback
=
lambda
reader
:
fluid
.
layers
.
io
.
shuffle
(
reader
,
buffer_size
=
200
))
self
.
test_main
(
decorator_callback
=
lambda
reader
:
fluid
.
layers
.
io
.
shuffle
(
reader
,
buffer_size
=
200
))
def
test_double_buffer_reader
(
self
):
self
.
test_main
(
decorator_callback
=
lambda
reader
:
fluid
.
layers
.
io
.
double_buffer
(
reader
,
place
=
'cuda:0'
if
fluid
.
core
.
is_compiled_with_cuda
()
else
'cpu'
))
place
=
'cuda:0'
if
fluid
.
core
.
is_compiled_with_cuda
()
else
'cpu'
))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录