---
title: "ClikaRT::ops::scatter_add"
sidebar_label: "scatter_add"
description: "scatter with ACCUMULATION: out[.., index[p], ..] += src[p]; duplicate destinations sum."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

## scatter\_add() {#scatter_add}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`scatter_add`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `dim`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `index`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `src`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`bool` `deterministic` `=` `false`<br />
)

</div>

[`scatter`](./scatter.md#scatter) with ACCUMULATION: `out[.., `[`index`](./index-fn.md#index)`[p], ..] += src[p]`; duplicate destinations sum.

**Parameters**

- `deterministic`: selects the deterministic accumulate path on devices where the faster default is run-to-run-variable on duplicate destinations (device atomics); the CPU is deterministic regardless of the flag. Default `false`.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when `dim` is out of range, the shapes disagree, or the index dtype is wrong (`code_name()` carries the reason).

**Returns:** a new tensor shaped like `input`.

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 2666

</div>
