torch.Tensor.index_reduce_
Tensor.index_reduce_(dim, index, source, reduce, *, include_self=True) -> Tensor
Accumulate the elements of "source" into the "self" tensor by
   accumulating to the indices in the order given in "index" using the
   reduction given by the "reduce" argument. For example, if "dim ==
   0", "index[i] == j", "reduce == prod" and "include_self == True"
   then the "i"th row of "source" is multiplied by the "j"th row of
   "self". If "include_self="True"", the values in the "self" tensor
   are included in the reduction, otherwise, rows in the "self" tensor
   that are accumulated to are treated as if they were filled with the
   reduction identites.
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 with "reduce="prod"" and "include_self=True" the
   output is given as: