Skip to content

Commit

Permalink
[Bug] Fix unused prefetch switch for NeighborSampler and LayerSampler (
Browse files Browse the repository at this point in the history
…dmlc#457)

* forgot prefetch switch

* yet another stupid bug
  • Loading branch information
BarclayII authored Mar 19, 2019
1 parent 33b9c38 commit 341dbea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/dgl/contrib/sampling/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def __init__(

if num_prefetch:
self._prefetching_wrapper_class = prefetching_wrapper_class
self._num_prefetch = num_prefetch
self._num_prefetch = num_prefetch

def fetch(self, current_nodeflow_index):
'''
Expand Down Expand Up @@ -295,7 +295,7 @@ def __init__(
prefetch=False,
add_self_loop=False):
super(NeighborSampler, self).__init__(
g, batch_size, seed_nodes, shuffle, num_workers * 2,
g, batch_size, seed_nodes, shuffle, num_workers * 2 if prefetch else 0,
ThreadPrefetchingWrapper)

assert node_prob is None, 'non-uniform node probability not supported'
Expand Down Expand Up @@ -361,7 +361,7 @@ def __init__(
num_workers=1,
prefetch=False):
super(LayerSampler, self).__init__(
g, batch_size, seed_nodes, shuffle, num_workers * 2,
g, batch_size, seed_nodes, shuffle, num_workers * 2 if prefetch else 0,
ThreadPrefetchingWrapper)

assert node_prob is None, 'non-uniform node probability not supported'
Expand Down

0 comments on commit 341dbea

Please sign in to comment.