---
title: "ClikaRT::ops::pad"
sidebar_label: "pad"
description: "Pad each axis by interleaved (lo, hi) pairs in layout order, left-to-right: pair i pads axis i (the first pair is the leading axis)."
---

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

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

## pad() {#pad}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`pad`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const` [`ScalarOrTensor`](../ScalarOrTensor.md)`>` `pad`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`PadMode`](./index.md#PadMode) `mode` `=` [`PadMode::Constant`](./index.md#PadMode),<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<`[`ScalarOrTensor`](../ScalarOrTensor.md)`>` `value` `=` `std::nullopt`<br />
)

</div>

Pad each axis by interleaved `(lo, hi)` pairs in layout order, left-to-right: pair `i` pads axis `i` (the first pair is the leading axis). Provide fewer pairs than the rank to pad only the leading axes; a negative width crops that side. `mode` selects the fill; `value` is the Constant fill (default 0).

<div class="api-declared">

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

</div>
