Add graph batching support to `dgl.knn_graph()`
See original GitHub issue🚀 Feature
Adding graph batching support to dgl.knn_graph()
Motivation
Being able to provide a batch of coordinates/features to knn_graph()
would allow users to develop much more efficient graph construction pipelines in their projects.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Batched Graph Classification with DGL - DGL Docs
Graphs can have various length (e.g. number of nodes and edges). To address this, DGL provides a dgl.batch() API. It leverages the trick...
Read more >BatchedDGLGraph – Enable batched graph operations
Class for batched DGL graphs. A BatchedDGLGraph basically merges a list of small graphs into a giant graph so that one can perform...
Read more >Batched Graph Classification with DGL
batching multiple graphs of variable size and shape with DGL; training a graph neural network for a simple graph classification task ...
Read more >dgl.batch — DGL 0.8.2post1 documentation - DGL Docs
The function supports batching batched graphs. The batch size of the result graph is the sum of the batch sizes of all the...
Read more >Implementing a batch of batches - Deep Graph Library
I'm trying to use dgl.batch to batch the different independent graphs, and then use dgl.contrib.sampling.NeighborSampler to randomly sample some of the nodes ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@amorehead To workaround the issue, you can use
set_batch_num_nodes
andset_batch_num_edges
to override those information manually. There is an ongoing PR to fix this issue.Hi, if your input is a 3D tensor (e.g. [B, N, 3]), I think you can get a batched graph by
knn_graphs
. You can find an example at the end of the doc hereIf your input is not padded, say you have a set of input ([N1, 3], [N2, 3], …), you can also use the
dgl.segmented_knn_graph
.