---
title: "ClikaRT::ops::clamp_"
sidebar_label: "clamp_"
description: "In-place clamp: writes the result through self; same formula, arguments, and error conditions as clamp()."
---

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

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

## clamp\_() {#clamp_}

<div class="api-signature">

[`Tensor`](../Tensor.md)`&` **`clamp_`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md)`&` `self`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<`[`ScalarOrTensor`](../ScalarOrTensor.md)`>` `min` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<`[`ScalarOrTensor`](../ScalarOrTensor.md)`>` `max` `=` `std::nullopt`<br />
)

</div>

In-place [`clamp`](./clamp.md#clamp): writes the result through `self`; same formula, arguments, and error conditions as [`clamp()`](./clamp.md#clamp). Either bound may be absent (`std::nullopt`), a one-sided clamp; tensor bounds broadcast against `self`. A view input writes through its base storage. Returns `self` under the value surface, [`Result`](../Result.md)`<void>` under the [`Result`](../Result.md) surface; [`CLIKART_CHECK`](../../index.md#CLIKART_CHECK) is the mode-stable spelling.

<div class="api-declared">

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

</div>
