---
title: "ClikaRT::ops::unsqueeze"
sidebar_label: "unsqueeze"
description: "Insert a size-1 dim at dim. The position is normalized against the OUTPUT rank, so -1 appends at the trailing end. Returns a view (no copy)."
---

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

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

## unsqueeze() {#unsqueeze}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`unsqueeze`**([`Tensor`](../Tensor.md) `input`, `int64_t` `dim`)

</div>

Insert a size-1 dim at `dim`. The position is normalized against the OUTPUT rank, so `-1` appends at the trailing end. Returns a view (no copy).

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when `dim` is outside the output's rank (`code_name()` carries the reason).

**Returns:** a view of `input` with rank + 1.

<div class="api-declared">

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

</div>
