# tensorflow::ops::ScatterMax Class Reference

# tensorflow::
ops::
ScatterMax

`
#include <state_ops.h>
`


Reduces sparse updates into a variable reference using the
`
max
`
operation.

## Summary


This operation computes

```
# Scalar indices
ref[indices, ...] = max(ref[indices, ...], updates[...])

# Vector indices (for each i)
ref[indices[i], ...] = max(ref[indices[i], ...], updates[i, ...])

# High rank indices (for each i, ..., j)
ref[indices[i, ..., j], ...] = max(ref[indices[i, ..., j], ...], updates[i, ..., j, ...])
```

<br />


This operation outputs
`
ref
`
after the update is done. This makes it easier to chain operations that need to use the reset value.


Duplicate entries are handled correctly: if multiple
`
indices
`
reference the same location, their contributions combine.


Requires
`
updates.shape = indices.shape + ref.shape[1:]
`
or
`
updates.shape = []
`
.


![](https://www.tensorflow.org/static/versions/r2.5/api_docs/cc/images/ScatterAdd.png)

<br />


Args:

- scope: A [Scope](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- ref: Should be from a `
  https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/variable#classtensorflow_1_1ops_1_1_variable
  ` node.
- indices: A tensor of indices into the first dimension of `
  ref
  ` .
- updates: A tensor of updated values to reduce into `
  ref
  ` .

<br />


Optional attributes (see
`
https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/scatter-max/attrs#structtensorflow_1_1ops_1_1_scatter_max_1_1_attrs
`
):

- use_locking: If True, the update will be protected by a lock; otherwise the behavior is undefined, but may exhibit less contention.

<br />


Returns:

- `
  https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output
  ` : = Same as `
  ref
  ` . Returned as a convenience for operations that want to use the updated values after the update is done.

<br />

| ### Constructors and Destructors ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/scatter-max#classtensorflow_1_1ops_1_1_scatter_max_1a4b1981c9ecfc07eecf70ad30681d1dc9 (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input ref, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input indices, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input updates) ` ||
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/scatter-max#classtensorflow_1_1ops_1_1_scatter_max_1aea5c929e2ffcd0b4976bbedfc0903340 (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input ref, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input indices, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input updates, const https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/scatter-max/attrs#structtensorflow_1_1ops_1_1_scatter_max_1_1_attrs & attrs) ` ||

| ### Public attributes ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/scatter-max#classtensorflow_1_1ops_1_1_scatter_max_1a6cea238b2ed3345fd004087afbcacaa0 ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/scatter-max#classtensorflow_1_1ops_1_1_scatter_max_1aca68eaae434ee66a9e3be45e8e0f8856 ` | ` :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |

| ### Public functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/scatter-max#classtensorflow_1_1ops_1_1_scatter_max_1ad80fd35ea7dbc046710b422267f92451 () const ` | ` ::tensorflow::Node * ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/scatter-max#classtensorflow_1_1ops_1_1_scatter_max_1a7a138a1072efbcfc196122618e9fa683 () const ` | ` ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/scatter-max#classtensorflow_1_1ops_1_1_scatter_max_1a630424d5ee3a2fffc53b48acea14c38d () const ` | ` ` |

| ### Public static functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/scatter-max#classtensorflow_1_1ops_1_1_scatter_max_1aa62f389510e2320cf2bb0b64c40fa9db (bool x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/scatter-max/attrs#structtensorflow_1_1ops_1_1_scatter_max_1_1_attrs ` |

| ### Structs ||
|---|---|
| [tensorflow:: ops:: ScatterMax:: Attrs](https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/scatter-max/attrs) | Optional attribute setters for [ScatterMax](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/scatter-max#classtensorflow_1_1ops_1_1_scatter_max) . |

## Public attributes

### operation

```
Operation operation
```

### output_ref

```
::tensorflow::Output output_ref
```

## Public functions

### ScatterMax

```
 ScatterMax(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input ref,
  ::tensorflow::Input indices,
  ::tensorflow::Input updates
)
```

### ScatterMax

```
 ScatterMax(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input ref,
  ::tensorflow::Input indices,
  ::tensorflow::Input updates,
  const ScatterMax::Attrs & attrs
)
```

### node

```
::tensorflow::Node * node() const 
```

### operator::tensorflow::Input

```
 operator::tensorflow::Input() const 
```

### operator::tensorflow::Output

```
 operator::tensorflow::Output() const 
```

## Public static functions

### UseLocking

```
Attrs UseLocking(
  bool x
)
```