Skip to content
项目
群组
代码片段
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录/注册
切换导航
pytorch
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
提交
议题看板
打开侧边栏
pytorch
pytorch
提交
bb4ff00f
提交
bb4ff00f
编写于
8月 01, 2019
作者:
Tongzhou Wang
提交者:
Soumith Chintala
8月 01, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix pin_memory_thread not exiting quickly (#23647)
上级
49e32ffc
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
6 行增加
和
2 行删除
+6
-2
pin_memory.py
torch/utils/data/_utils/pin_memory.py
+1
-1
dataloader.py
torch/utils/data/dataloader.py
+5
-1
未找到文件。
torch/utils/data/_utils/pin_memory.py
浏览文件 @
bb4ff00f
...
...
@@ -22,7 +22,7 @@ def _pin_memory_loop(in_queue, out_queue, device_id, done_event):
except
queue
.
Empty
:
continue
idx
,
data
=
r
if
not
isinstance
(
data
,
ExceptionWrapper
):
if
not
done_event
.
is_set
()
and
not
isinstance
(
data
,
ExceptionWrapper
):
try
:
data
=
pin_memory
(
data
)
except
Exception
:
...
...
torch/utils/data/dataloader.py
浏览文件 @
bb4ff00f
...
...
@@ -886,9 +886,13 @@ class _MultiProcessingDataLoaderIter(_BaseDataLoaderIter):
# corrupted data in `worker_result_queue` which `pin_memory_thread`
# reads from.
if
hasattr
(
self
,
'pin_memory_thread'
):
self
.
pin_memory_thread_done_event
.
set
()
# Use hasattr in case error happens before we set the attribute.
self
.
pin_memory_thread_done_event
.
set
()
# Send something to pin_memory_thread in case it is waiting
# so that it can wake up and check `pin_memory_thread_done_event`
self
.
worker_result_queue
.
put
((
None
,
None
))
self
.
pin_memory_thread
.
join
()
self
.
worker_result_queue
.
close
()
# Exit workers now.
self
.
workers_done_event
.
set
()
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录