---
title: "ClikaRT::ops::empty_strided"
sidebar_label: "empty_strided"
description: "Uninitialized tensor with caller-chosen sizes AND strides (element units). The storage is sized to the strided footprint."
---

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

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

## empty\_strided() {#empty_strided}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`empty_strided`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `size`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `stride`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`DataType`](../../index.md#DataType) `dtype`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`StreamOrDevice`](../StreamOrDevice.md) `device` `=` `{}`<br />
)

</div>

Uninitialized tensor with caller-chosen sizes AND strides (element units).

The storage is sized to the strided footprint. Extents and strides are host integers (no tensor-valued entries on this factory).

**Parameters**

- `size`: the extents, one per dim.
- `stride`: element stride per dim (packed row-major = [`empty`](./empty.md#empty)'s layout).
- `dtype`: element type.
- `device`: stream or device to allocate on. Default: the default device.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when `size` and `stride` disagree in rank or a value is negative (`code_name()` carries the reason).

**Returns:** a new uninitialized tensor with exactly the given layout.

<div class="api-declared">

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

</div>
