Accumulate src into dst element-wise (dst += src).
Handles all three Storage variants:
CpuStorage / CpuStorage— hand-written typed loop forF32 / F64 / I32 / I64.GpuStorage / GpuStorage— MLX add followed by rewrap.SharedStoragevariants — obtain aCpuStorageview of the shared region and delegate to the CPU path.
Parameters
dstStorage&Accumulator buffer; modified in place.
srcconst Storage&Buffer to add into
dst.Raises
DtypeMismatchdst and src have different element dtypes.DeviceMismatchdst and src belong to different device categories.Notes
The most common caller is AccumulateGrad, which uses this to
fold each newly-arrived gradient into a leaf's running .grad.