Option for dgl.batch() to automatically combine feature schemas
- Dominant language
- Python
- Stars
- 14.3k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
## 🚀 Feature
Suppose graph g1 has a node type A with schema `{'x': Scheme(shape=(2,3), dtype=torch.float32), 'y': Scheme(shape=(), dtype=torch.int64)}` and g2 has a node type A with schema `{'x': Scheme(shape=(2,3), dtype=torch.float32), 'z': Scheme(shape=(1,5), dtype=torch.int64)}`.
`dgl.batch()` should have an option to automatically combine them so that the graphs in the resulting batch have node type A with schema `{'x': Scheme(shape=(2,3), dtype=torch.float32), 'y': Scheme(shape=(), dtype=torch.int64), 'z': Scheme(shape=(1,5), dtype=torch.int64)}`/
## Motivation
I am constructing a graph G using a set of subgraphs. As I construct G, I add and remove features from its nodes. The way that I add the subgraphs is `G = dgl.batch([G, subgraph])`. However, the nodes and edges of G, having been processed, have different features than the raw subgraphs. So DGL throws an error, that they don't have the same schemas.
It would be very convenient to have an option to automatically combine feature schemas when they don't conflict, including initializing the features in graphs that did not contain them before.
## Alternatives
Preprocessing the graphs before batching to add features they don't share.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.