How do I convert a list of `DGLGraphs`

to a torch tensor? `torch.stack`

does not work here.

I see that I can use `dgl.batch()`

but I need a way to access/extract each graph in the list. Is there a way to do this?

# Converting a list of DGLGraph to torch tensor

Hi, could you please elaborate more on what to do with this torch tensor?

I have a batch of a list of graphs i.e. a list of list of graphs. For one example in the batch, I want to encode each graph in the list separately to a 1D tensor (using GCN or some other graph encoder)

For `BatchedDGLGraph`

, we provide a set of APIs to manipulate a minibatch of graph including readout(extract a summarization of each individual graph of the batched graph, e.g. max, sum, mean, weighted sum, etc.).

You can refer to global pooling modules to see how to build global pooling layers based on top of BatchedDGLGraph APIs.

1 Like

Thanks! `unbatch()`

was the function I was looking for.