# set_node_lazy_features¶

class dgl.dataloading.base.set_node_lazy_features[source]

Assign lazy features to the ndata 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.ndata.update({k: LazyFeature(k, g.ndata[dgl.NID]) for k in feature_names})


If the graph is heterogeneous, this is equivalent to:

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

Parameters

See also

dgl.LazyFeature