---
title: "ClikaRT::ops::fill"
sidebar_label: "fill"
description: "A new tensor with input's shape and dtype, every element set to value. input supplies GEOMETRY only; its data is never read. value is a literal or a 0-D Tensor (a tensor value traces symbolically)."
---

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

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

## fill() {#fill}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`fill`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ScalarOrTensor`](../ScalarOrTensor.md) `value`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`StreamOrDevice`](../StreamOrDevice.md) `device` `=` `{}`<br />
)

</div>

A new tensor with `input`'s shape and dtype, every element set to `value`.

`input` supplies GEOMETRY only; its data is never read. `value` is a literal or a 0-D [Tensor](../Tensor.md) (a tensor value traces symbolically).

**Parameters**

- `input`: shape/dtype donor.
- `value`: the fill value, cast to `input`'s dtype.
- `device`: optional stream override. Default: `input`'s placement.

**Throws**

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

**Returns:** a new tensor shaped like `input`, filled with `value`.

<div class="api-declared">

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

</div>
