set_src_lazy_features

class dgl.dataloading.base.set_src_lazy_features(g, feature_names)[source]

Bases:

Assign lazy features to the srcdata 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 guide-minibatch-prefetching for a detailed explanation.

If the graph is homogeneous, this is equivalent to:

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

If the graph is heterogeneous, this is equivalent to:

for type_, names in feature_names.items():
    g.srcnodes[type_].data.update(
        {k: LazyFeature(k, g.srcnodes[type_].data[dgl.NID]) for k in names})
Parameters:

See also

dgl.LazyFeature