chainer.functions.scatter_add¶
-
chainer.functions.scatter_add(a, slices, b)[source]¶ Adds given values to specified elements of an array.
This function adds
bto the specified elements of the copy ofa, and returns the copy. The value of the originalais not changed.- Parameters
a (
Variableor N-dimensional array) – A variable.slices (int, slice, Ellipsis, None, integer array-like, boolean array-like or tuple of them) – It is an integer, a slice, an ellipsis, a numpy.newaxis, an integer array-like, a boolean array-like or tuple of them.
b (
Variableor N-dimensional array) – A variable that is scatter added toa. Its shape has to equala[slices]because broadcasting of variables is not supported.
- Returns
A
Variableobject which is the result of scatter addition.
Note
It only supports types that are supported by CUDA’s atomicAdd when an integer array is included in
slices. The supported types arenumpy.float32,numpy.int32,numpy.uint32,numpy.uint64andnumpy.ulonglong.Note
It does not support
slicesthat contains multiple boolean arrays.See also
numpy.add.at()andcupyx.scatter_add().