Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[1.x, BUGFIX] WAR the dataloader issue with forked processes holding stale references #19924

Merged
merged 1 commit into from
Feb 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions python/mxnet/gluon/data/dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,10 @@ def __init__(self, dataset, batch_size=None, shuffle=False, sampler=None,
self._num_workers = num_workers if num_workers >= 0 else 0
self._worker_pool = None
self._prefetch = max(0, int(prefetch) if prefetch is not None else 2 * self._num_workers)
nd.waitall()
import gc
gc.collect()
nd.waitall()
if self._num_workers > 0:
if self._thread_pool:
self._worker_pool = ThreadPool(self._num_workers,
Expand Down