Store a feature tensor for graph representation?

Assume I have g = dgl.DGLGraph() with
DGLGraph(num_nodes=11795, num_edges=15000, ndata_schemes={'id': Scheme(shape=(), dtype=torch.int64)} edata_schemes={'id': Scheme(shape=(), dtype=torch.int64), 'type': Scheme(shape=(), dtype=torch.int64)}),
how can I set a graph feature of size (200, 500) for g instead of allocating memory for each node or edge in g.ndata or g.edata?
Note that the graph feature will vary as the nodes and edges update.

If your reason for storing graph features is due the variable nature of node and edge updates, perhaps you could consider Heterograph.


Why you want to store it in the graph? It’s not supported and You can just put the tensor aside and use it wherever you want.