Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
826c607e
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2307
Star
20932
Fork
5423
代码
文件
提交
分支
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看板
未验证
提交
826c607e
编写于
7月 02, 2020
作者:
K
Kaipeng Deng
提交者:
GitHub
7月 02, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix test multiprocess dataloader static (#25287)
* fix test_multiprocess_dataloader_static random fail. test=develop
上级
4474fc10
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
16 deletion
+15
-16
python/paddle/fluid/dataloader/dataloader_iter.py
python/paddle/fluid/dataloader/dataloader_iter.py
+10
-2
python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_dynamic.py
...d/tests/unittests/test_multiprocess_dataloader_dynamic.py
+1
-6
python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_static.py
...id/tests/unittests/test_multiprocess_dataloader_static.py
+4
-8
未找到文件。
python/paddle/fluid/dataloader/dataloader_iter.py
浏览文件 @
826c607e
...
...
@@ -128,8 +128,10 @@ class _DataLoaderIterSingleProcess(_DataLoaderIterBase):
self
.
_need_check_feed
=
[
v
.
desc
.
need_check_feed
()
for
v
in
self
.
_feed_list
]
# if only 1 place, do not need to keep order
self
.
_blocking_queue
=
core
.
init_lod_tensor_blocking_queue
(
core
.
Variable
(),
self
.
_blocking_queue_capacity
,
True
)
core
.
Variable
(),
self
.
_blocking_queue_capacity
,
len
(
self
.
_places
)
>
1
)
self
.
_reader
=
core
.
create_py_reader
(
self
.
_blocking_queue
,
self
.
_var_names
,
self
.
_shapes
,
self
.
_dtypes
,
self
.
_need_check_feed
,
self
.
_places
,
self
.
_use_buffer_reader
,
True
)
...
...
@@ -280,8 +282,9 @@ class _DataLoaderIterMultiProcess(_DataLoaderIterBase):
self
.
_need_check_feed
=
[
v
.
desc
.
need_check_feed
()
for
v
in
self
.
_feed_list
]
# if only 1 place, do not need to keep order
self
.
_blocking_queue
=
core
.
init_lod_tensor_blocking_queue
(
core
.
Variable
(),
self
.
_outstanding_capacity
,
True
)
core
.
Variable
(),
self
.
_outstanding_capacity
,
len
(
self
.
_places
)
>
1
)
self
.
_reader
=
core
.
create_py_reader
(
self
.
_blocking_queue
,
self
.
_var_names
,
self
.
_shapes
,
self
.
_dtypes
,
self
.
_need_check_feed
,
self
.
_places
,
self
.
_use_buffer_reader
,
True
)
...
...
@@ -442,6 +445,11 @@ class _DataLoaderIterMultiProcess(_DataLoaderIterBase):
# get data again
data
=
self
.
_data_queue
.
get
(
timeout
=
self
.
_timeout
)
except
Exception
as
e
:
# check if thread done event set when waiting data
if
self
.
_thread_done_event
.
is_set
():
continue
# check failed workers
failed_workers
=
[]
for
i
,
w
in
enumerate
(
self
.
_workers
):
if
self
.
_worker_status
[
i
]
and
not
w
.
is_alive
():
...
...
python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_dynamic.py
浏览文件 @
826c607e
...
...
@@ -28,12 +28,7 @@ from paddle.fluid.dygraph.nn import Linear
from
paddle.fluid.dygraph.base
import
to_variable
from
test_multiprocess_dataloader_static
import
RandomDataset
,
prepare_places
EPOCH_NUM
=
5
BATCH_SIZE
=
16
IMAGE_SIZE
=
784
SAMPLE_NUM
=
400
CLASS_NUM
=
10
from
test_multiprocess_dataloader_static
import
EPOCH_NUM
,
BATCH_SIZE
,
IMAGE_SIZE
,
SAMPLE_NUM
,
CLASS_NUM
class
SimpleFCNet
(
fluid
.
dygraph
.
Layer
):
...
...
python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_static.py
浏览文件 @
826c607e
...
...
@@ -25,10 +25,10 @@ import numpy as np
import
paddle.fluid
as
fluid
from
paddle.io
import
Dataset
,
BatchSampler
,
DataLoader
EPOCH_NUM
=
5
BATCH_SIZE
=
16
IMAGE_SIZE
=
784
SAMPLE_NUM
=
4
00
EPOCH_NUM
=
3
BATCH_SIZE
=
8
IMAGE_SIZE
=
32
SAMPLE_NUM
=
1
00
CLASS_NUM
=
10
...
...
@@ -157,10 +157,6 @@ class TestStaticDataLoader(unittest.TestCase):
return
ret
def
test_main
(
self
):
# FIXME(dkp): disable for random fail in Py35 cloud,
# should be fixed ASAP
if
sys
.
version
[:
3
]
==
'3.5'
:
return
for
p
in
prepare_places
(
True
):
results
=
[]
for
num_workers
in
[
0
,
2
]:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录