MCPcopy Index your code
hub / github.com/dmlc/dgl / sample

Method sample

python/dgl/dataloading/graphsaint.py:142–163  ·  view source on GitHub ↗

Sampling function Parameters ---------- g : DGLGraph The graph to sample from. indices : Tensor Placeholder not used. Returns ------- DGLGraph The sampled subgraph.

(self, g, indices)

Source from the content-addressed store, hash-verified

140 return sampled_nodes.unique().type(g.idtype)
141
142 def sample(self, g, indices):
143 """Sampling function
144
145 Parameters
146 ----------
147 g : DGLGraph
148 The graph to sample from.
149 indices : Tensor
150 Placeholder not used.
151
152 Returns
153 -------
154 DGLGraph
155 The sampled subgraph.
156 """
157 node_ids = self.sampler(g)
158 sg = g.subgraph(
159 node_ids, relabel_nodes=True, output_device=self.output_device
160 )
161 set_node_lazy_features(sg, self.prefetch_ndata)
162 set_edge_lazy_features(sg, self.prefetch_edata)
163 return sg

Callers

nothing calls this directly

Calls 2

set_node_lazy_featuresFunction · 0.85
set_edge_lazy_featuresFunction · 0.85

Tested by

no test coverage detected