dgl.DGLHeteroGraph.edge_attr_schemes

DGLHeteroGraph.edge_attr_schemes(etype=None)[source]

Return the edge feature schemes for the specified type.

Each feature scheme is a named tuple that stores the shape and data type of the edge feature.

Parameters:etype (str or tuple of str, optional) – The edge type. Can be omitted if there is only one edge type in the graph. (Default: None)
Returns:The schemes of edge feature columns.
Return type:dict of str to schemes

Examples

The following uses PyTorch backend.

>>> g = dgl.bipartite([(0, 0), (1, 0), (1, 2), (2, 1)], 'user', 'plays', 'game')
>>> g.edges['user', 'plays', 'game'].data['h'] = torch.randn(4, 4)
>>> g.edge_attr_schemes(('user', 'plays', 'game'))
{'h': Scheme(shape=(4,), dtype=torch.float32)}