Skip to main content

ClikaRT::ops::logsumexp

function

logsumexp()

Tensor logsumexp(
    Tensor x,
    ClikaRT::Span<const std::int64_t> dims,
    bool keepdim = false
)

Numerically stable log(sum(exp(x))) over dims.

out=logidimsexi\mathrm{out} = \log \sum_{i \in \text{dims}} e^{x_i}

Computed with the max-shift trick, so large magnitudes do not overflow. dims is required here (no reduce-all default).

Parameters

  • x: the input tensor; float dtype.
  • dims: axes to reduce.
  • keepdim: keep reduced axes as size-1 dims; default false.

Returns: the reduced tensor; shape = x minus dims.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) on an out-of-range dims entry or a non-float input.

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