# tf.raw_ops.Gather

<br />

Gather slices from `params` according to `indices`.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.raw_ops.Gather`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/Gather)

<br />

    tf.raw_ops.Gather(
        params, indices, validate_indices=True, name=None
    )

`indices` must be an integer tensor of any dimension (usually 0-D or 1-D).
Produces an output tensor with shape `indices.shape + params.shape[1:]` where:

        # Scalar indices
        output[:, ..., :] = params[indices, :, ... :]

        # Vector indices
        output[i, :, ..., :] = params[indices[i], :, ... :]

        # Higher rank indices
        output[i, ..., j, :, ... :] = params[indices[i, ..., j], :, ..., :]

If `indices` is a permutation and `len(indices) == params.shape[0]` then
this operation will permute `params` accordingly.

`validate_indices`: DEPRECATED. If this operation is assigned to CPU, values in
`indices` are always validated to be within range. If assigned to GPU,
out-of-bound indices result in safe but unspecified behavior, which may include
raising an error.
![](https://www.tensorflow.org/images/Gather.png)

<br />

<br />

<br />

| ## Args ||
|---|---|
| `params` | A `Tensor`. |
| `indices` | A `Tensor`. Must be one of the following types: `int32`, `int64`. |
| `validate_indices` | An optional `bool`. Defaults to `True`. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Tensor`. Has the same type as `params`. ||

<br />