In *gcn_reduce*, the neighbouring features are summed up by

```
return {'h' : torch.sum(nodes.mailbox['msg'], dim=1)}
```

But why “dim=1”?

Shouldn’t we take the sum over the dimension of samples, which should be “dim=0”?

In *gcn_reduce*, the neighbouring features are summed up by

```
return {'h' : torch.sum(nodes.mailbox['msg'], dim=1)}
```

But why “dim=1”?

Shouldn’t we take the sum over the dimension of samples, which should be “dim=0”?

Hi,

In reduce function, we automatically did degree bucketing to accelerate the program, which means node with same in degrees are bucketed together. Therefore the shape of `nodes.mailbox['msg']`

is (batch_size, in_degrees, feature shape). And in reduce function you should return a dict of tensors with batch_size as first dimension. Therefore if you want to sum over all neighbors, it should be done on the dimension 1. Hope this helps!

That helps a lot!

Could you also tell me what is the shape of *edges.src[‘h’]* supposed to be, in the message function:

```
def gcn_message(edges):
# The argument is a batch of edges.
# This computes a (batch of) message called 'msg' using the source node's feature 'h'.
return {'msg' : edges.src['h']}
```

Thanks a lot!

The first dimension of `edges.src['h']`

is the number of edges got here. You can view it as each row is one edge, and the data init is the corresponding src data.

Checkout our tutorial Pagerank with DGL message passing. It explains the questions you have.