Tree-LSTM, the order of massages in mailbox

Hi, I am new to DGL and GNN, but I have some experience with NLP and Pytorch.

For N-ary Tree-LSTM (binary in the implementation), one important thing is that you need to keep the order of children correct, i.e. distinguish between left and right child.
In the following line of code, how to ensure the order of massage in mailbox?
h_cat = nodes.mailbox['h'].view(nodes.mailbox['h'].size(0), -1)
Does DGL automatically sort the messages by some order, like the order of edges in construction?

I think this might need to dig deeper to the core functions of DGL, is there any recommanded resources to learn from?

Yes exactly, the edges are sorted by the same order as they were constructed.

I think you just need to understand dgl/core.py at 06b9ec2e8e5daaa6938d5549eb5beacb25ed6c09 · dmlc/dgl · GitHub and dgl/heterograph.py at master · dmlc/dgl · GitHub.

Thanks for your great answer. It is really the core functions. :wink:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.