Hi
How can I go about summing the outgoing edge weights for a node? For example, in the GATConv layer, given source node i, we have adjacent nodes \mathcal{N_{i}}. For j \in \mathcal{N_{i}}, we have the following:
where \alpha_{i,j} is the attention that node i pays to node j. The GATConv
layer computes the weighted sum of adjacent node features as:
graph.update_all(fn.u_mul_e('ft', 'a', 'm'),
fn.sum('m', 'ft'))
We could compute the in-degree of attention weights as (which sums to 1 per node, by definition):
graph.update_all(fn.copy_e('a', 'm'),
fn.sum('m', 'in_degree'))
How can I go about computing the out_degree?
I came up with this solution:
rev = dgl.reverse(graph)
rev.edata['a'] = graph.edata['a']
rev.update_all(fn.copy_e('a', 'm'),
fn.sum('m', 'out_degree'))
graph.ndata['out_degree'] = rev.ndata['out_degree']
but is there a more conventional / efficient way for doing so?
k