dgl.dataloading

dgl.dataloading 包提供了两个原语来构建从图数据中加载的数据管道。Sampler 表示从原始图中生成子图样本的算法,而 DataLoader 表示这些样本的可迭代对象。

DGL 提供了许多内置的采样器,这些采样器是 Sampler 的子类。 创建新的采样器遵循相同的范式。请阅读我们的用户指南章节 第6章:大型图上的随机训练 以获取更多示例和解释。

整个包仅适用于PyTorch后端。

数据加载器

DataLoader

采样图数据加载器。

GraphDataLoader

批量图数据加载器。

DistNodeDataLoader

用于分布式图存储的节点采样图数据加载器。

DistEdgeDataLoader

用于分布式图存储的边缘采样图数据加载器。

采样器

Sampler

图采样器的基类。

NeighborSampler

通过多层GNN的邻居采样构建节点表示计算依赖关系的采样器。

LaborSampler

Sampler that builds computational dependency of node representations via labor sampling for multilayer GNN from the NeurIPS 2023 paper Layer-Neighbor Sampling -- Defusing Neighborhood Explosion in GNNs

MultiLayerFullNeighborSampler

采样器通过从多层GNN的所有邻居获取消息来构建节点表示的计算依赖关系。

ClusterGCNSampler

Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks中提取的集群采样器

ShaDowKHopSampler

K跳子图采样器来自Deep Graph Neural Networks with Shallow Subgraph Samplers

SAINTSampler

GraphSAINT: 基于图采样的归纳学习方法中随机采样节点/边/路径

采样器变换

as_edge_prediction_sampler(sampler[, ...])

从节点采样器创建一个边采样器。

BlockSampler([prefetch_node_feats, ...])

用于以消息传递流图(MFGs)形式采样小批量的基类。

用于特征预取的实用类和函数

set_node_lazy_features

Assign lazy features to the ndata of the input graph for prefetching optimization.

set_edge_lazy_features

Assign lazy features to the edata of the input graph for prefetching optimization.

set_src_lazy_features

Assign lazy features to the srcdata of the input graph for prefetching optimization.

set_dst_lazy_features

Assign lazy features to the dstdata of the input graph for prefetching optimization.

LazyFeature

特征预取的占位符。