dgl.DGLHeteroGraph.node_attr_schemes

DGLHeteroGraph.node_attr_schemes(ntype=None)[source]

Return the node feature schemes for the specified type.

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

Parameters:ntype (str, optional) – The node type. Can be omitted if there is only one node type in the graph. Error will be raised otherwise. (Default: None)
Returns:The schemes of node feature columns.
Return type:dict of str to schemes

Examples

The following uses PyTorch backend.

>>> g = dgl.graph([(0, 0), (1, 2)], 'user', 'follows')
>>> g.nodes['user'].data['h'] = torch.randn(3, 4)
>>> g.node_attr_schemes('user')
{'h': Scheme(shape=(4,), dtype=torch.float32)}