Dimensions of nodes.mailbox


When I debug the GAT model, I am a little confused by the dimensions of nodes.mailbox[‘e’], generally, it will be a 3-d tensor, anyone could explain the meaning of each dimension?

Here is a code demo from GAT tutorial:

    def reduce_func(self, nodes):
        # reduce UDF for equation (3) & (4)
        # equation (3)
        alpha = F.softmax(nodes.mailbox['e'], dim=1)
        # equation (4)
        h = torch.sum(alpha * nodes.mailbox['z'], dim=1)
        return {'h': h}

We perform a degree bucketing mechanism where messages for nodes with a same degree are processed together. Let’s say the three dimensions are separately (A, B, C), then A is the number of nodes with the same degree, B is the number of messages received for each node (in most cases this is equivalent to degree), and C is the size of message features. Hope this helps.

1 Like