---
title: "ClikaRT::ops::logit"
sidebar_label: "logit"
description: "Elementwise log-odds. \\[ \\mathrm{logit}(x_i) = \\log\\frac{x_i}{1 - x_i} \\] With eps set, the input is first clipped to [eps, 1 - eps]; absent means no clipping, so inputs outside (0, 1) produce NaN / ±…"
---

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

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

## logit() {#logit}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`logit`**([`Tensor`](../Tensor.md) `input`, `std::optional<double>` `eps` `=` `std::nullopt`)

</div>

Elementwise log-odds.

$$
\mathrm{logit}(x_i) = \log\frac{x_i}{1 - x_i}
$$

With `eps` set, the input is first clipped to `[eps, 1 - eps]`; absent means no clipping, so inputs outside `(0, 1)` produce NaN / ±inf per IEEE semantics.

**Parameters**

- `input`: the input tensor (probabilities).
- `eps`: optional clip bound; `std::nullopt` (default) disables clipping.

**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, same shape and dtype as `input`.

```cpp
auto z = ClikaRT::ops::logit(p, 1e-6);
```

<div class="api-declared">

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

</div>
