<br />

<button value="stable" default="">See Stable</button> <button value="nightly">See Nightly</button>

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/numpy.py#L525-L559) |

Returns the maximum of an array or maximum value along an axis.

#### View aliases


**Main aliases**

[`tf.keras.ops.numpy.amax`](https://www.tensorflow.org/api_docs/python/tf/keras/ops/amax.md.txt)

<br />

```python
tf.keras.ops.amax(
    x, axis=None, keepdims=False
)
```

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor. |
| `axis` | Axis along which to compute the maximum. By default (`axis=None`), find the maximum value in all the dimensions of the input array. |
| `keepdims` | If `True`, axes which are reduced are left in the result as dimensions that are broadcast to the size of the original input tensor. Defaults to `False`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| An array with the maximum value. If `axis=None`, the result is a scalar value representing the maximum element in the entire array. If `axis` is given, the result is an array with the maximum values along the specified axis. ||

<br />

#### Examples:

```python
x = keras.ops.convert_to_tensor([[1, 3, 5], [2, 3, 6]])
keras.ops.amax(x)
array(6, dtype=int32)
```

```python
x = keras.ops.convert_to_tensor([[1, 6, 8], [1, 5, 2]])
keras.ops.amax(x, axis=0)
array([1, 6, 8], dtype=int32)
```

```python
x = keras.ops.convert_to_tensor([[1, 6, 8], [1, 5, 2]])
keras.ops.amax(x, axis=1, keepdims=True)
array([[8], [5]], dtype=int32)
```