# reverse

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/reverse

```python
Graph.reverse(tensor, axis, *, name=None)
```

Reverse a tensor along some specified dimensions.

### Parameters
* **tensor** (*np.ndarray* *or* [*Tensor*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor)) – The tensor that you want to reverse. It must have at least
  one dimension.
* **axis** (*int* *or* *list* *[* *int* *]*) – The dimension or dimensions along which you want to reverse the tensor.
* **name** (*str* *or* *None* *,* *optional*) – The name of the node.
### Returns
The reversed tensor.
### Return type
[Tensor](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor)

## Examples

```pycon
>>> x = np.array([[1, 2, 3], [4, 5, 6]])
```

Reverse an array along its first dimension.

```pycon
>>> graph.reverse(x, 0, name="a")
<Tensor: name="a", operation_name="reverse", shape=(2, 3)>
>>> result = bo.execute_graph(graph=graph, output_node_names="a")
>>> result["output"]["a"]["value"]
array([[4, 5, 6],
       [1, 2, 3]])
```

Reverse an array along its first and second dimension.

```pycon
>>> graph.reverse(x, [0, 1], name="b")
<Tensor: name="b", operation_name="reverse", shape=(2, 3)>
>>> result = bo.execute_graph(graph=graph, output_node_names="b")
>>> result["output"]["b"]["value"]
array([[6, 5, 4],
       [3, 2, 1]])
```
