How come couldn't we have fc.mean()?

How come couldn’t we have fc.mean()?

Could you please elaborate more? What is fc?

I guess you are referring to graph readout by average? It is included in our next release plan. Please stay tuned!

In the meanwhile, you could use sum readout and divide it by the degree vector (using DGLGraph.in_degrees). Please be careful about zero degree nodes as it will cause NaN error.

Sorry for the unclear question, I was referring to new built-in reduce functions:


As u can see that we have function.sum() and function.max(), while exclude function.mean(). I don’t understand the reason of it, cause the implementation would be quite straightforward – just do function.sum()/degrees. Of course, one could implement it by adding a apply_node function:

def forward(g):
    ...
    g.ndata['degrees'] = g.in_degrees()
    ...

def apply_node(nodes):
    return {'h': g.ndata['h']/g.ndata['degrees']}
    

But it’s not direct enough.

Now we have it, thanks to dgl team.:heart: