Each graph in blocks
is associated with a GNN layer. Basically, the representation on the source of blocks[0]
will be aggregated with the first GNN layer into the destination of blocks[0]
, which in turn will be used for the source of blocks[1]
. The process goes on until the last layer. So we only need to assign blocks[0].srcdata
.
The reason to additionally assign to blocks[-1].dstdata
is that, the architecture for our PinSage implementation is the aggregation of the neighborhood features (hence blocks[0].srcdata
), plus an MLP of the nodes’ own features (hence blocks[-1].dstdata
, since the destination nodes of blocks[-1]
are identical to the seed nodes for sampling).
See dgl/model.py at master · dmlc/dgl · GitHub.