dgl.DGLHeteroGraph.set_e_initializer

DGLHeteroGraph.set_e_initializer(initializer, field=None, etype=None)[source]

Set the initializer for empty edge features.

Initializer is a callable that returns a tensor given the shape, data type and device context.

When a subset of the edges are assigned a new feature, initializer is used to create feature for rest of the edges.

Parameters:
  • initializer (callable) – The initializer, mapping (shape, data type, context) to tensor.
  • field (str, optional) – The feature field name. Default is set an initializer for all the feature fields.
  • etype (str or tuple of str, optional) – The edge type. Can be omitted if there is only one edge type in the graph. Error will be raised otherwise. (Default: None)

Note

User defined initializer must follow the signature of dgl.init.base_initializer()