In forward of my model, I want to first process a batch of tensors that will return a batch of variable length tensors. Based on these lengths I want to construct a graph and then apply a message passing scheme. Is it possible to train end to end?
Your description of the problem is too brief, could you tell more on what’s the “batch of variable length tensors” and other details?
Also it seems an algorithm problem rather than a DGL problem, right?
I’m not asking for help on my algorithm, I’m asking whether or not DGL is well suited in creating and reforming graphs in between layers. All of the examples I’ve seen have just been passing a static input graph through the pipeline.
You can add nodes and edges to graphs between layers(or at any time). However currently delete edges and nodes are not supported. You may need to use
send_and_recv to do the operation on a partial graph.
Dynamic graph is one of the important features of DGL. Checkout these related examples and tutorials: https://docs.dgl.ai/tutorials/models/index.html#generative-models