dgl.DGLGraph.edge_attr_schemes¶
-
DGLGraph.
edge_attr_schemes
()[source]¶ Return the edge feature schemes.
Each feature scheme is a named tuple that stores the shape and data type of the node feature
Returns: The schemes of edge feature columns. Return type: dict of str to schemes Examples
Note
Here we use pytorch syntax for demo. The general idea applies to other frameworks with minor syntax change (e.g. replace
torch.tensor
withmxnet.ndarray
).>>> import torch as th >>> G = dgl.DGLGraph() >>> G.add_nodes(3) >>> G.add_edges([0, 1], 2) # 0->2, 1->2 >>> G.edata['y'] = th.zeros((2, 4)) >>> G.edge_attr_schemes() {'y': Scheme(shape=(4,), dtype=torch.float32)}