stop calling cupy_max for speed
@@ -2255,7 +2255,7 @@ cpdef _scatter_op_mask_single(ndarray a, ndarray mask, v, int axis, op):
# broadcast v to shape determined by the mask
mask_scanned = scan(mask.astype(numpy.int32).ravel()) # starts with 1
- n_true = int(mask_scanned.max())
+ n_true = int(mask_scanned[-1])
lshape = a.shape[:axis]
rshape = a.shape[axis + mask.ndim:]
v_shape = lshape + (n_true,) + rshape
