---
title: "ClikaRT::ops::reshape_as"
sidebar_label: "reshape_as"
description: "Reshape input to other's shape (other supplies extents only; its data is never read). The element counts must match."
---

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

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

## reshape\_as() {#reshape_as}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`reshape_as`**([`Tensor`](../Tensor.md) `input`, [`Tensor`](../Tensor.md) `other`)

</div>

Reshape `input` to `other`'s shape (`other` supplies extents only; its data is never read). The element counts must match.

Returns a view sharing storage when `input`'s stride layout can express the new shape; copies into a fresh dense tensor otherwise.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when the element counts differ (`code_name()` carries the reason).

**Returns:** the reshaped tensor, a view when the layout permits.

<div class="api-declared">

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

</div>
