采样器

class dgl.dataloading.Sampler[source]

Bases: object

图采样器的基类。

所有图采样器必须继承这个类并重写sample方法。

from dgl.dataloading import Sampler

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

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