Sampler

class dgl.dataloading.Sampler[source]

Bases: object

Base class for graph samplers.

All graph samplers must subclass this class and override the sample method.

from dgl.dataloading import Sampler

class SubgraphSampler(Sampler):
    def __init__(self):
        super().__init__()

    def sample(self, g, indices):
        return g.subgraph(indices)