dgl.dataloading.base.set_edge_lazy_features

dgl.dataloading.base.set_edge_lazy_features(g, feature_names)[source]

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

When used in a Sampler, lazy features mark which data should be fetched before computation in model. See 6.8 Feature Prefetching for a detailed explanation.

If the graph is homogeneous, this is equivalent to:

g.edata.update({k: LazyFeature(k, g.edata[dgl.EID]) for k in feature_names})

If the graph is heterogeneous, this is equivalent to:

for type_, names in feature_names.items():
    g.edges[type_].data.update(
        {k: LazyFeature(k, g.edges[type_].data[dgl.EID]) for k in names})
Parameters
  • g (DGLGraph) – The graph.

  • feature_names (list[str] or dict[etype, list[str]]) – The feature names to prefetch. The etype key is either a string or a triplet.

See also

dgl.LazyFeature()