# tf.raw_ops.Reverse

<br />

Reverses specific dimensions of a tensor.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.raw_ops.Reverse(
        tensor, dims, name=None
    )

Given a `tensor`, and a `bool` tensor `dims` representing the dimensions
of `tensor`, this operation reverses each dimension i of `tensor` where
`dims[i]` is `True`.

`tensor` can have up to 8 dimensions. The number of dimensions
of `tensor` must equal the number of elements in `dims`. In other words:

`rank(tensor) = size(dims)`

#### For example:

    # tensor 't' is [[[[ 0,  1,  2,  3],
    #                  [ 4,  5,  6,  7],
    #                  [ 8,  9, 10, 11]],
    #                 [[12, 13, 14, 15],
    #                  [16, 17, 18, 19],
    #                  [20, 21, 22, 23]]]]
    # tensor 't' shape is [1, 2, 3, 4]

    # 'dims' is [False, False, False, True]
    reverse(t, dims) ==> [[[[ 3,  2,  1,  0],
                            [ 7,  6,  5,  4],
                            [ 11, 10, 9, 8]],
                           [[15, 14, 13, 12],
                            [19, 18, 17, 16],
                            [23, 22, 21, 20]]]]

    # 'dims' is [False, True, False, False]
    reverse(t, dims) ==> [[[[12, 13, 14, 15],
                            [16, 17, 18, 19],
                            [20, 21, 22, 23]
                           [[ 0,  1,  2,  3],
                            [ 4,  5,  6,  7],
                            [ 8,  9, 10, 11]]]]

    # 'dims' is [False, False, True, False]
    reverse(t, dims) ==> [[[[8, 9, 10, 11],
                            [4, 5, 6, 7],
                            [0, 1, 2, 3]]
                           [[20, 21, 22, 23],
                            [16, 17, 18, 19],
                            [12, 13, 14, 15]]]]

<br />

<br />

<br />

| ## Args ||
|---|---|
| `tensor` | A `Tensor`. Must be one of the following types: `uint8`, `int8`, `uint16`, `int16`, `uint32`, `int32`, `uint64`, `int64`, `bool`, `bfloat16`, `half`, `float32`, `float64`, `complex64`, `complex128`, `string`. Up to 8-D. |
| `dims` | A `Tensor` of type `bool`. 1-D. The dimensions to reverse. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

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

<br />