dgl.dataloading.Sampler

class dgl.dataloading.Sampler[source]

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)
__init__()

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__

Initialize self.

sample(g, indices)

Abstract sample method.