scatter_reduce(input: Tensor, dim: int, index: Tensor, src: Tensor, reduce: str = 'sum', include_self: bool = True)Reduce src into input along dim at positions given by index.
Multi-reduction sibling of scatter_add. When several entries
of src target the same position the chosen reduce op decides
how they combine. include_self controls whether the existing
value in input participates in the reduction or is replaced.
Parameters
inputTensorDestination tensor; not mutated (a fresh copy is returned).
dimintAxis along which
index / src are scattered.indexTensorInteger tensor broadcasting against
src; each entry names
the position along dim of input to update.srcTensorValues to scatter into
input at the positions named by
index.reducestr= 'sum'Reduction op applied when multiple
src values collide on
the same target. One of 'sum' (default), 'mean',
'prod', 'amax', 'amin'.include_selfbool= TrueWhen
True (default) the existing value in input is part
of the reduction set; when False it is overwritten and only
the scattered values count.Returns
TensorSame shape and dtype as input.