class dgl.dataloading.MultiLayerFullNeighborSampler(num_layers, **kwargs)[source]

Sampler that builds computational dependency of node representations by taking messages from all neighbors for multilayer GNN.

This sampler will make every node gather messages from every single neighbor per edge type.



To train a 3-layer GNN for node classification on a set of nodes train_nid on a homogeneous graph where each node takes messages from all neighbors for the first, second, and third layer respectively (assuming the backend is PyTorch):

>>> sampler = dgl.dataloading.MultiLayerFullNeighborSampler(3)
>>> dataloader = dgl.dataloading.DataLoader(
...     g, train_nid, sampler,
...     batch_size=1024, shuffle=True, drop_last=False, num_workers=4)
>>> for input_nodes, output_nodes, blocks in dataloader:
...     train_on(blocks)


For the concept of MFGs, please refer to User Guide Section 6 and Minibatch Training Tutorials.

__init__(num_layers, **kwargs)[source]

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


__init__(num_layers, **kwargs)

Initialize self.


Assign lazy features for prefetching.

sample(g, seed_nodes[, exclude_eids])

Sample a list of blocks from the given seed nodes.

sample_blocks(g, seed_nodes[, exclude_eids])

Generates a list of blocks from the given seed nodes.