// Convolution via sparse row sum. Converts [|E| x M_out] feature matrix to
// [n x M_out] feature matrix.
size = torch.Size([adj.size(0), adj.size(1), output.size(1)])
adj = torch.sparse.FloatTensor(indices, output, size)
output = sum(adj, dim=1)
// TODO: root node and weight mean
// root_weight = weight[torch.arange(kernel_size[-1])]
// root_weight.mean(0)
After Change
// Convolution via `scatter_add`. Converts [|E| x M_out] feature matrix to
// [n x M_out] feature matrix.
zero = torch.zeros(adj.size(1), output.size(1))
zero = zero.cuda() if output.is_cuda else zero
zero = Variable(zero) if not torch.is_tensor(output) else zero
row = row.view(-1, 1).expand(row.size(0), output.size(1))
output = zero.scatter_add_(0, row, output)
// Weighten root node features by multiplying with the meaned weights at the
// origin.
index = torch.arange(0, kernel_size[-1]).long()
root_weight = weight[index].mean(0)output += torch.mm(features, root_weight)
if bias is not None:
output += bias