---
title: "ClikaRT::ops::flip"
sidebar_label: "flip"
description: "Reverse the element order along each dim in dims. Always copies; a reversed layout is not expressible as a view in this runtime, so this op never returns one."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

## flip() {#flip}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`flip`**([`Tensor`](../Tensor.md) `input`, [`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `dims`)

</div>

Reverse the element order along each dim in `dims`.

Always copies; a reversed layout is not expressible as a view in this runtime, so this op never returns one.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when a dim repeats or is out of range (`code_name()` carries the reason).

**Returns:** a new tensor, `input`'s shape and dtype.

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 3281

</div>
