---
title: "ClikaRT::ops::contiguous"
sidebar_label: "contiguous"
description: "Packs the tensor into row-major contiguous storage. A no-op passthrough (no copy, same storage) when the input is already contiguous and force_copy is false."
---

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

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

## contiguous() {#contiguous}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`contiguous`**([`Tensor`](../Tensor.md) `input`, `bool` `force_copy` `=` `false`)

</div>

Packs the tensor into row-major contiguous storage.

A no-op passthrough (no copy, same storage) when the input is already contiguous and `force_copy` is `false`. Kernels stride natively; call this only when YOUR host-side consumption needs dense memory, never "to be safe" before an op.

**Parameters**

- `input`: the input tensor (any strides).
- `force_copy`: always materialize. Default `false`.

**Throws**

- `ClikaRT::Error`: when the input's dtype/shape is not served for this operation (the machine-readable reason rides `code_name()`).

**Returns:** a contiguous tensor with `input`'s shape, dtype, and values.

<div class="api-declared">

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

</div>
