torch.Tensor.index_add_
Tensor.index_add_(dim, index, source, *, alpha=1) -> Tensor
Accumulate the elements of "alpha" times "source" into the "self"
   tensor by adding to the indices in the order given in "index". For
   example, if "dim == 0", "index[i] == j", and "alpha=-1", then the
   "i"th row of "source" is subtracted from the "j"th row of "self".
The "dim"th dimension of "source" must have the same size as the
   length of "index" (which must be a vector), and all other
   dimensions must match "self", or an error will be raised.
For a 3-D tensor the output is given as:
  self[index[i], :, :] += alpha * src[i, :, :]  # if dim == 0
  self[:, index[i], :] += alpha * src[:, i, :]  # if dim == 1
  self[:, :, index[i]] += alpha * src[:, :, i]  # if dim == 2

Note:
 This operation may behave nondeterministically when given tensors
 on a CUDA device. See Reproducibility for more information.

Parameters: