MCPcopy
hub / github.com/dmlc/dgl / WorkerInitWrapper

Class WorkerInitWrapper

python/dgl/dataloading/dataloader.py:743–754  ·  view source on GitHub ↗

Wraps the :attr:`worker_init_fn` argument of the DataLoader to set the number of DGL OMP threads to 1 for PyTorch DataLoader workers.

Source from the content-addressed store, hash-verified

741
742
743class WorkerInitWrapper(object):
744 """Wraps the :attr:`worker_init_fn` argument of the DataLoader to set the number of DGL
745 OMP threads to 1 for PyTorch DataLoader workers.
746 """
747
748 def __init__(self, func):
749 self.func = func
750
751 def __call__(self, worker_id):
752 set_num_threads(1)
753 if self.func is not None:
754 self.func(worker_id)
755
756
757def create_tensorized_dataset(

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected