Skip to main content

ClikaRT::ops::logit

function

logit()

Tensor logit(Tensor x, std::optional<double> eps = std::nullopt)

Elementwise log-odds.

logit(xi)=logxi1xi\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

  • x: 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 x.

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

Declared in ClikaRT/compute/ops.h, line 5050