Skip to main content

ClikaRT::ops::quantile

function

quantile()​

Tensor quantile(
    Tensor input,
    ScalarOrTensor q,
    std::optional<int64_t> dim = std::nullopt,
    bool keepdim = false,
    QuantileInterp interpolation = QuantileInterp::Linear
)

The q-th quantile of input along dim.

q is a scalar or 1-D tensor of probabilities in [0, 1]. Absent dim flattens input first. The output prepends q's shape to the reduced shape; interpolation picks the between-ranks strategy (Linear by default; see QuantileInterp for the full set).

Parameters

  • input: the input tensor; float dtype.
  • q: probability level(s) in [0, 1].
  • dim: axis to reduce; absent = flatten.
  • keepdim: keep the reduced axis as size 1; default false.
  • interpolation: between-ranks strategy; default Linear.

Returns: the quantile values; q's shape prepended to the reduced shape; dtype of input.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when a q entry falls outside [0, 1] or dim is out of range.

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