Solved by ptrblck in post #2 
              
              
                scatter_add_ should correctly propagate the gradients as seen in this example: 
x = torch.rand(2, 5, requires_grad=True)
out = torch.ones(3, 5).scatter_add_(0, torch.tensor([[0, 1, 2, 0, 0], [2, 0, 0, 1, 2]]), x)
out.sum().backward()
print(x.grad)
> tensor([[1., 1., 1., 1., 1.],
        [1., 1., 1.,…