Skip to main content

ClikaRT::ops::where

function

2 overloads.

where(Tensor, Tensor, Tensor)

Tensor where(
    Tensor condition,
    Tensor x,
    Tensor y
)

Elementwise select: condition ? x : y, with numpy-style broadcasting across all three operands.

condition is Bool; the output takes the broadcast shape and the promoted common dtype of x and y.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when condition is not Bool or the shapes do not broadcast (code_name() carries the reason).

Returns: a new tensor of the broadcast shape.

auto safe = ClikaRT::ops::where(denom_ok, quotient, fallback);

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

where(Tensor)

Tensor where(Tensor condition)

The coordinates where condition is nonzero, sugar for nonzero.

Returns the same [n, ndim] Int64 coordinate matrix as ONE tensor (not a per-dim tuple); the row count is data-dependent.

Throws

  • ClikaRT::Error: when the input's dtype is not served for this operation (the machine-readable reason rides code_name()).

Returns: a new [n, ndim] Int64 coordinate matrix.

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