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

Method __init__

python/dgl/sampling/utils.py:32–53  ·  view source on GitHub ↗
(self, exclude_eids)

Source from the content-addressed store, hash-verified

30 """
31
32 def __init__(self, exclude_eids):
33 device = None
34 if isinstance(exclude_eids, Mapping):
35 for _, v in exclude_eids.items():
36 if device is None:
37 device = F.context(v)
38 break
39 else:
40 device = F.context(exclude_eids)
41 self._exclude_eids = None
42 self._filter = None
43
44 if device == F.cpu():
45 # TODO(nv-dlasalle): Once Filter is implemented for the CPU, we
46 # should just use that irregardless of the device.
47 self._exclude_eids = (
48 recursive_apply(exclude_eids, F.zerocopy_to_numpy)
49 if exclude_eids is not None
50 else None
51 )
52 else:
53 self._filter = recursive_apply(exclude_eids, utils.Filter)
54
55 def _find_indices(self, parent_eids):
56 """Find the set of edge indices to remove."""

Callers

nothing calls this directly

Calls 4

contextMethod · 0.80
recursive_applyFunction · 0.50
itemsMethod · 0.45
cpuMethod · 0.45

Tested by

no test coverage detected