<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/core.py#L506-L539) |

Update an input by slicing in a tensor of updated values.

    tf.keras.ops.slice_update(
        inputs, start_indices, updates
    )

At a high level, this operation does
`inputs[start_indices: start_indices + updates.shape] = updates`.
Assume inputs is a tensor of shape `(D0, D1, ..., Dn)`,
`start_indices` must be a list/tuple of n integers, specifying the starting
indices. `updates` must have the same rank as `inputs`, and the size of each
dim must not exceed `Di - start_indices[i]`. For example, if we have 2D
inputs `inputs = np.zeros((5, 5))`, and we want to update the intersection
of last 2 rows and last 2 columns as 1, i.e.,
`inputs[3:, 3:] = np.ones((2, 2))`, then we can use the code below:

    inputs = np.zeros((5, 5))
    start_indices = [3, 3]
    updates = np.ones((2, 2))
    inputs = keras.ops.slice_update(inputs, start_indices, updates)

<br />

<br />

<br />

| ## Args ||
|---|---|
| `inputs` | A tensor, the tensor to be updated. |
| `start_indices` | A list/tuple of shape `(inputs.ndim,)`, specifying the starting indices for updating. |
| `updates` | A tensor, the new values to be put to `inputs` at `indices`. `updates` must have the same rank as `inputs`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tensor, has the same shape and dtype as `inputs`. ||

<br />