---
title: "ClikaRT::ops::transpose"
sidebar_label: "transpose"
description: "Swap dim0 and dim1, permute for exactly two dims. Returns a view (no copy). ClikaRT::Error (INVALID_ARGUMENT) when either dim is out of range (code_name() carries the reason)."
---

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

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

## transpose() {#transpose}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`transpose`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `dim0`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `dim1`<br />
)

</div>

Swap `dim0` and `dim1`, [`permute`](./permute.md#permute) for exactly two dims. Returns a view (no copy).

**Throws**

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

**Returns:** a view of `input` with the two dims swapped.

<div class="api-declared">

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

</div>
