ClikaRT::ops
namespace
Classes
| Name | Description |
|---|---|
EllipsisTag | ...: expands to full slices over the dims no other entry names. |
IndexBound | An integer-typed op bound, a reshape dim: either a concrete int64_t literal or a 0-D/1-D integer Tensor (e.g. a shape_host read), so a shape-consuming argument composes without pulling concrete sizes to the host. Narrower than ScalarOrTensor by design: no float ctor (reshape(x, {1.5}) fails at compile time) and bool is deleted (it would otherwise promote silently to an index). |
IndexEntry | One subscript position of index / index_put, the standard tensor indexing vocabulary: an int (select), a bool (0-D mask), an integer or boolean Tensor (advanced indexing), an IndexSlice, ellipsis, or new_axis. A braced integer list indexes via a Tensor (Tensor::from_data); pass it as the Tensor arm. |
IndexSlice | A [start, stop, step) range at one subscript position. Each slot is an IndexBound: an int literal, a 0-D/1-D integer Tensor, or absent (open bound; absent step is 1). all below is the fully-open slice. |
NewAxisTag | numpy None / a fresh size-1 dim at this position. |
ScalarOrTensor | A ClikaRT-level value type (NOT op-layer machinery): one optional slot that carries a scalar (double / integer) OR a tensor. Every ctor is implicit on purpose. Pass a bare double, an integer, a Tensor, or std::nullopt straight to a ScalarOrTensor parameter; spelling the wrap at a call site (ops::ScalarOrTensor(x)) is redundant noise. ops::ScalarOrTensor remains a valid spelling via the alias below. |
Enumerations
enum Activation
enum class Activation : std::uint8_t
A fused activation epilogue. Identity = none. The gated kinds (SwiGlu, GeGlu, ReGlu, Situ) take a concatenated [*, 2d] gate‖up input and emit [*, d], used as a fused projection epilogue.
| Enumerator | Value | Description |
|---|---|---|
Identity | 0 | 0 on purpose: a zero-initialized field means "no activation" |
Sigmoid | 1 | |
Silu | 2 | |
Relu | 3 | |
Gelu | 4 | exact, erf-based |
FastGelu | 5 | the fast approximation (binds the tanh form) |
Tanh | 6 | |
QuickGelu | 7 | sigmoid approximation: x·sigmoid(1.702·x) |
Relu6 | 8 | min(max(x, 0), 6) |
TanhGelu | 9 | the tanh approximation, named |
SwiGlu | 10 | |
GeGlu | 11 | |
ReGlu | 12 | |
Situ | 13 | Soft-capped gated activation; BOTH halves transform: out = β·tanh(gate/β)·sigmoid(gate) · lβ·tanh(up/lβ). The two soft-cap scalars ride ops::matmul/ops::linear as situ_beta (β, the gate cap) and situ_linear_beta (lβ, the up cap); both must be > 0 and come from the model's own config; passing Situ without them (or either scalar with any other kind) rejects. Computed at fp32 end-to-end with one demote at the store for f16/bf16 outputs. |
Declared in ClikaRT/compute/op_enums.h, line 16
enum GeluMode
enum class GeluMode : std::uint8_t
GELU approximation: exact (None), Tanh (the tanh approximation), Quick (sigmoid-based), or Fast.
| Enumerator | Value | Description |
|---|---|---|
None | 0 | |
Tanh | ||
Quick | ||
Fast |
Declared in ClikaRT/compute/op_enums.h, line 45
enum RotaryMode
enum class RotaryMode
How a rotary embedding pairs the channels it rotates.
| Enumerator | Description |
|---|---|
NeoX | split-half: pair (i, i + rotary_dim/2) |
Interleaved | adjacent-pair: pair (2i, 2i+1) |
Declared in ClikaRT/compute/op_enums.h, line 53
enum MoeRouting
enum class MoeRouting : std::uint8_t
Mixture-of-Experts routing: how the router logits select the top-k experts and produce the combine weights. Values are PINNED (ABI).
| Enumerator | Value | Description |
|---|---|---|
SoftmaxTopK | 0 | softmax over all experts, then top-k (Mixtral / Qwen / gemma) |
TopKSoftmax | 1 | top-k of the raw logits, then softmax over the k |
Sigmoid | 2 | per-expert sigmoid, then top-k |
SigmoidGroupTopK | 3 | sigmoid + selection bias, group-limited (DeepSeek-V3) |
SparseMixer | 4 | sparse-mixer top-2 (Phi-3.5-MoE) |
PreComputed | 5 | the logits are already the probability grid |
Declared in ClikaRT/compute/op_enums.h, line 60
enum SwigluFusion
enum class SwigluFusion : std::uint8_t
How the gate‖up halves are laid out in a gated MoE FC1 output. Values are PINNED (ABI).
| Enumerator | Value | Description |
|---|---|---|
Unfused | 0 | gate comes from a SEPARATE fc3 matrix |
Interleaved | 1 | one fused [E, 2I, H]; gate = even, up = odd columns |
Concat | 2 | one fused [E, 2I, H]; gate = first half, up = second |
Declared in ClikaRT/compute/op_enums.h, line 71
enum RoundingMode
enum class RoundingMode : std::uint8_t
Integer-division / floor-div rounding.
| Enumerator | Value | Description |
|---|---|---|
None | 0 | |
Trunc | ||
Floor |
Declared in ClikaRT/compute/op_enums.h, line 78
enum ModMode
enum class ModMode : std::uint8_t
mod convention: Python (sign follows divisor) or C (sign follows dividend).
| Enumerator | Value | Description |
|---|---|---|
Python | 0 | |
C |
Declared in ClikaRT/compute/op_enums.h, line 81
enum Reduction
enum class Reduction : std::uint8_t
Loss reduction over the batch.
| Enumerator | Value | Description |
|---|---|---|
None | 0 | |
Mean | ||
Sum |
Declared in ClikaRT/compute/op_enums.h, line 84
enum PadMode
enum class PadMode : std::uint8_t
pad boundary handling. Constant fills with the given value; Reflect mirrors about the edge (edge sample not repeated); Replicate repeats the edge sample; Circular wraps around.
| Enumerator | Value | Description |
|---|---|---|
Constant | 0 | |
Reflect | ||
Replicate | ||
Circular |
Declared in ClikaRT/compute/op_enums.h, line 90
enum InterpMode
enum class InterpMode : std::uint8_t
Resampling mode for ops::interpolate (rank dispatch picks the spatial variant: Linear covers linear/bilinear/trilinear by input rank).
| Enumerator | Value | Description |
|---|---|---|
Nearest | 0 | |
Linear | ||
Bicubic | ||
Area | ||
NearestExact |
Declared in ClikaRT/compute/op_enums.h, line 94
enum ScatterReduceMode
enum class ScatterReduceMode : std::uint8_t
scatter_reduce combine op. Sum / Prod / Mean accumulate; AMax / AMin keep the extremum.
| Enumerator | Value | Description |
|---|---|---|
Sum | 0 | |
Prod | ||
Mean | ||
AMax | ||
AMin |
Declared in ClikaRT/compute/op_enums.h, line 98
enum QuantileInterp
enum class QuantileInterp : std::uint8_t
quantile interpolation between data points. Linear interpolates between the two neighbors; Lower / Higher take a neighbor; Nearest the closer one; Midpoint their mean.
| Enumerator | Value | Description |
|---|---|---|
Linear | 0 | |
Lower | ||
Higher | ||
Nearest | ||
Midpoint |
Declared in ClikaRT/compute/op_enums.h, line 103
enum PixelShuffleMode
enum class PixelShuffleMode : std::uint8_t
pixel_shuffle channel ordering.
| Enumerator | Value | Description |
|---|---|---|
CRD | 0 | |
DCR |
Declared in ClikaRT/compute/op_enums.h, line 106
enum GridSampleMode
enum class GridSampleMode : std::uint8_t
grid_sample interpolation.
| Enumerator | Value | Description |
|---|---|---|
Bilinear | 0 | |
Nearest | ||
Bicubic |
Declared in ClikaRT/compute/op_enums.h, line 109
enum GridSamplePaddingMode
enum class GridSamplePaddingMode : std::uint8_t
grid_sample out-of-bounds handling.
| Enumerator | Value | Description |
|---|---|---|
Zeros | 0 | |
Border | ||
Reflection |
Declared in ClikaRT/compute/op_enums.h, line 112
enum MeshgridIndexing
enum class MeshgridIndexing : std::uint8_t
meshgrid output orientation: NumPy's indexing= argument. IJ (matrix indexing) keeps output shapes in the input order; XY (Cartesian) swaps the first two axes.
| Enumerator | Value | Description |
|---|---|---|
IJ | 0 | |
XY |
Declared in ClikaRT/compute/op_enums.h, line 117
enum HashTensorMode
enum class HashTensorMode : std::uint8_t
hash_tensor combine mode. XorSum xor-folds the elements' mixed hashes; order-independent, so a digest survives layout permutations.
| Enumerator | Value | Description |
|---|---|---|
XorSum | 0 |
Declared in ClikaRT/compute/op_enums.h, line 121
enum QComputeMode
enum class QComputeMode : std::uint8_t
How a weight-only-quantized contraction (qmatmul_woq / qlinear_woq / the *_woq conv family) contracts a floating-point activation against a quantized weight. ExactFP (the default) dequantizes the weight and runs the float dot, bit-faithful to the stored scale / zero-point. DynamicInt8 dynamically quantizes the activation to int8 and runs an integer dot, faster on dot-product hardware, at a small accuracy cost (the activation loses precision). A ROUTING HINT, not a shape contract: shapes outside a backend's fused coverage fall back to exact math.
| Enumerator | Value | Description |
|---|---|---|
ExactFP | 0 | |
DynamicInt8 | 1 |
Declared in ClikaRT/compute/op_enums.h, line 131
enum RopeScaling
enum class RopeScaling
RoPE frequency-scaling family (long-context extension). Every family also folds an OPTIONAL 1-D [rotary_dim/2] freq_factors per-band divisor table into its frequencies (absent ⇒ no division); the 2-D [2, rotary_dim/2] short/long-row form belongs to the LongRoPE families alone, which REQUIRE a table in one of the two shapes.
| Enumerator | Description |
|---|---|
None | inv_freq = theta^(-2i/d) |
Linear | position interpolation: angle uses pos / scale |
NTK | static NTK-aware base scaling |
DynamicNTK | NTK with a runtime sequence-length trigger. |
YaRN | wavelength-ramp interpolation (beta_fast/beta_slow) |
Llama3 | Llama-3.1 piecewise inv_freq smoothing. |
LongRoPE | per-dim short/long factors; row + attention factor keyed on the BUILT cache length vs original_max_pos |
Proportional | zero-tail: first ⌊scale·d/2⌋ bands carry real frequencies (exponent over the full d), the rest are zero (identity rotation) |
LongRoPEShort | LongRoPE, SHORT row pinned statically (row 0); attention factor from the config ratio (scale), never the built length. |
LongRoPELong | LongRoPE, LONG row pinned statically (row 1); attention factor from the config ratio (scale). |
Declared in ClikaRT/compute/op_enums.h, line 138
Variables
ellipsis
EllipsisTag ellipsis {}
Declared in ClikaRT/compute/tensor.h, line 832
new_axis
NewAxisTag new_axis {}
Declared in ClikaRT/compute/tensor.h, line 835
slice_all
const IndexSlice slice_all {}
The fully-open slice (:). (all is taken by the reduction op.).
Declared in ClikaRT/compute/tensor.h, line 837
Functions
| Function | Description |
|---|---|
abs | Elementwise absolute value. |
abs_ | In-place abs: writes the result through self; same formula, arguments, and error conditions as abs(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
acos | Elementwise arccosine. |
acos_ | In-place acos: writes the result through self; same formula, arguments, and error conditions as acos(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
acosh | Elementwise inverse hyperbolic cosine. |
acosh_ | In-place acosh: writes the result through self; same formula, arguments, and error conditions as acosh(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
adaptive_avg_pool | Rank-generic adaptive average pooling to a target output size, channels-last. |
adaptive_avg_pool1d | 1-D adaptive average pooling of [N, L, C] to [N, L', C]; the window geometry is derived from output_size. See adaptive_avg_pool. |
adaptive_avg_pool2d | 2-D adaptive average pooling of [N, H, W, C] to [N, H', W', C]; windows derived so the output lands exactly on output_size = {H', W'}. {1, 1} is global average pooling. |
adaptive_avg_pool3d | 3-D adaptive average pooling of [N, D, H, W, C] to [N, D', H', W', C]. See adaptive_avg_pool. |
adaptive_max_pool | Rank-generic adaptive MAX pooling to a target output size, channels-last, the max sibling of adaptive_avg_pool. |
adaptive_max_pool1d | 1-D adaptive max pooling of [N, L, C] to [N, L', C]. See adaptive_max_pool. |
adaptive_max_pool2d | 2-D adaptive max pooling of [N, H, W, C] to [N, H', W', C]. {1, 1} is global max pooling. See adaptive_max_pool. |
adaptive_max_pool3d | 3-D adaptive max pooling of [N, D, H, W, C] to [N, D', H', W', C]. See adaptive_max_pool. |
add (2 overloads) | Adds other (scaled) to a elementwise. |
add_ | In-place add: writes through x; semantics as ops::add (which also documents broadcasting/promotion). ClikaRT::Error as the value form. |
add_layer_norm | Fused residual-add + normalization, on either side of the norm. Which data flow runs is inferred from which addends you supply; there is no mode flag:residual only → {ACT(norm(x + residual)·w + b), x + residual} post_residual only → {ACT(norm(x)·w + b) + post_residual, UNDEFINED} both → {ACT(norm(x + residual)·w + b) + post_residual, x + residual} neither → raises (that is a plain rms_norm/layer_norm) |
add_rms_norm | Fused residual-add + normalization, on either side of the norm. Which data flow runs is inferred from which addends you supply; there is no mode flag:residual only → {ACT(norm(x + residual)·w + b), x + residual} post_residual only → {ACT(norm(x)·w + b) + post_residual, UNDEFINED} both → {ACT(norm(x + residual)·w + b) + post_residual, x + residual} neither → raises (that is a plain rms_norm/layer_norm) |
all | True where EVERY element over dims is nonzero (logical AND reduce). |
allclose | Whether EVERY elementwise pair is approximately equal, a reduction to one verdict. |
amax | Maximum value of x over dims. |
amin | Minimum value of x over dims. |
aminmax | a 2-element array {min, max}. |
any | True where ANY element over dims is nonzero (logical OR reduce). |
arange | Evenly stepped 1-D range over the half-open interval [start, end). |
argmax | Index of the maximum of x over dims. |
argmin | Index of the minimum of x over dims. |
argsort | Indices that would sort x along dim (ascending unless descending). |
asin | Elementwise arcsine. |
asin_ | In-place asin: writes the result through self; same formula, arguments, and error conditions as asin(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
asinh | Elementwise inverse hyperbolic sine. |
asinh_ | In-place asinh: writes the result through self; same formula, arguments, and error conditions as asinh(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
atan | Elementwise arctangent. |
atan2 | Elementwise four-quadrant arc tangent of a/b (the angle of the point (b, a)), in radians. Broadcasts and promotes as add. the broadcast-shaped angles at the promoted float dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
atan2_ | In-place atan2: writes the angles through x. ClikaRT::Error as the value form. |
atan_ | In-place atan: writes the result through self; same formula, arguments, and error conditions as atan(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
atanh | Elementwise inverse hyperbolic tangent. |
atanh_ | In-place atanh: writes the result through self; same formula, arguments, and error conditions as atanh(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
atleast_1d | x with leading size-1 dims prepended until rank >= 1; a higher-rank input passes through unchanged. Returns a VIEW sharing x's storage (no copy). |
atleast_2d | x with leading size-1 dims prepended until rank >= 2 (see atleast_1d). Returns a view (no copy). |
atleast_3d | x with leading size-1 dims prepended until rank >= 3 (see atleast_1d). Returns a view (no copy). |
attention | Dense attention with the serving riders: per-head sink, logit soft-cap, sliding window, smoothed softmax. |
attention_over_cache | Attend a KV cache WITHOUT appending to it (a read-only re-attention). q is packed varlen [ΣS_q, H, D] (or hidden-folded [ΣS_q, num_heads*D] with num_heads set); cache_key/cache_value are a cache another attention call already appended: continuous head-major [max_seqs, H_kv, max_seq, D] with a rank-1 [B] kvcache_start (the layout selector; its values are not read, and q's position derives from cu_seqlens_k), or a paged block pool [num_blocks, H_kv, block_size, D] with a rank-2 [B, max_blocks] block table. On the continuous cache slot_ids ([B] Int32, in range, pairwise distinct) names each batch row's cache row; absent, batch row b reads cache row b. cu_seqlens_k is each sequence's TOTAL cached length: per-seq [B] or cumulative [B+1]. The cache is never written. When rope_cos/rope_sin are bound, rotary applies to q only (the cached keys are already rotated). Use case: a q-only module re-attending a sibling layer's cache. head_sink is the per-head softmax sink [H_q], a virtual logit folded into the softmax denominator, the same contract as the varlen face; it rides the parameter tail here. out_attn: q's shape with the trailing dim set to the cache's value head size. The read-only face's qk-norm tail rotates and norms q ONLY; the cached keys were already rotated+normed by the call that appended them; k_norm_gain rides along untouched so one argument set serves both the appending and the read-only attention. Same travel rule: gains come WITH qk_norm_eps and require the rope planes; absent ⇒ unchanged. |
attention_varlen | Variable-length (packed) form of attention: the serving riders over token-packed ragged batches. |
avg_pool | Rank-generic average pooling, channels-last. |
avg_pool1d | 1-D average pooling over [N, L, C] (channels-last). See avg_pool; stride empty = kernel_size. |
avg_pool2d | 2-D average pooling over [N, H, W, C] (channels-last). |
avg_pool3d | 3-D average pooling over [N, D, H, W, C] (channels-last). See avg_pool2d; parameters extend to {kD, kH, kW} etc. |
batch_norm | Per-channel batch normalization (inference form), channels-last. |
bernoulli | Independent Bernoulli draws from per-element success probabilities. |
bernoulli_ | In-place: overwrite self, whose values are the per-element success probabilities, with the 0/1 draws (self[i] ~ Bernoulli(self[i])). |
binary_cross_entropy | Binary cross-entropy on element-wise PROBABILITIES. |
binary_cross_entropy_with_logits | Binary cross-entropy on RAW LOGITS (sigmoid fused, numerically stable). |
bincount | Occurrence count (or weight sum) of each non-negative integer value. |
bitwise_and | Elementwise bitwise AND; the dtype law the whole bitwise family shares: integer and Bool dtypes only, and BOTH operands must carry ONE dtype (no promotion; a mixed pair is refused typed; a scalar other adopts a's dtype). Shapes broadcast per the standard rules; the output carries the shared dtype. The other bitwise ops state "dtype law as `bitwise_and`" instead of restating this. the broadcast-shaped AND at the operands' shared dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand dtypes differ, for a floating-point operand, or broadcast-incompatible shapes. auto masked = ClikaRT::ops::bitwise_and(flags, 0x0F); |
bitwise_and_ | In-place bitwise_and: writes the AND through x. ClikaRT::Error as the value form. |
bitwise_left_shift | Elementwise a << other. Integer dtypes only (Bool refuses; a shifted Bool byte has no meaning); otherwise dtype law as bitwise_and. The shift is a TOTAL function: a count outside [0, bit_width), negative included, yields the fully shifted-out value (zero fill), identically on every backend. the broadcast-shaped shifted values at the shared dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand dtypes differ, for a floating-point or Bool operand, or broadcast-incompatible shapes. |
bitwise_left_shift_ | In-place bitwise_left_shift: writes the shifted values through x. ClikaRT::Error as the value form. |
bitwise_not | Elementwise bitwise NOT (~x; logical NOT for Bool). Integer and Bool dtypes; the output keeps x's dtype. x's shape and dtype, complemented. ClikaRT::Error (INVALID_ARGUMENT) for a floating-point operand. |
bitwise_not_ | In-place bitwise_not: complements x in place. ClikaRT::Error as the value form. |
bitwise_or | Elementwise bitwise OR; dtype law as bitwise_and. the broadcast-shaped OR at the operands' shared dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand dtypes differ, for a floating-point operand, or broadcast-incompatible shapes. |
bitwise_or_ | In-place bitwise_or: writes the OR through x. ClikaRT::Error as the value form. |
bitwise_right_shift | Elementwise a >> other. Integer dtypes only (Bool refuses); otherwise dtype law as bitwise_and. ARITHMETIC (sign-propagating) for signed dtypes, logical for unsigned; the shift is a TOTAL function; a count outside [0, bit_width), negative included, yields the fully shifted-out value (sign fill 0/-1 for signed, 0 for unsigned), identically on every backend. the broadcast-shaped shifted values at the shared dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand dtypes differ, for a floating-point or Bool operand, or broadcast-incompatible shapes. |
bitwise_right_shift_ | In-place bitwise_right_shift: writes the shifted values through x. ClikaRT::Error as the value form. |
bitwise_xor | Elementwise bitwise XOR; dtype law as bitwise_and. the broadcast-shaped XOR at the operands' shared dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand dtypes differ, for a floating-point operand, or broadcast-incompatible shapes. |
bitwise_xor_ | In-place bitwise_xor: writes the XOR through x. ClikaRT::Error as the value form. |
bmm | Batched matrix multiply of two rank-3 tensors, with an optional fused bias and activation epilogue. |
broadcast_tensors | Broadcast every input to their common shape: dims are right-aligned, size-1 dims stretch, anything else must match. |
broadcast_to | Alias of expand under the NumPy name; same broadcasting rules, same view semantics. |
bucketize | Bucket index of each x element against a sorted 1-D boundaries. |
cast | Same-device dtype conversion. |
cast_like | cast to another tensor's dtype: cast(x, reference.dtype()). |
causal_conv_update | Depthwise causal short-conv serving step over a rolling per-sequence window. x [B, S, dim]; weight [dim, W] (oldest tap first); optional bias [dim]; state [B, dim, W] (same dtype as x) is read AND updated IN PLACE in both modes: S > 1 runs the prefill conv with each row's left context seeded from its window (a zero window is a fresh sequence, bit for bit; an S-token call over committed state equals S single-token steps exactly) and re-captures the window as the last W of (old window ++ the row's valid inputs; zero valid tokens leave it unchanged); S == 1 shift-inserts the new token and emits the tap dot. seq_lens ([B] Int32) bounds ragged prefill rows (their padding is zero post-activation). activation applies to the returned out [B, S, dim] only (Silu fuses in-kernel); the stored window stays pre-activation raw. slot_ids ([B] Int32, device-resident) addresses state as a SLAB [num_slots, dim, W]: batch row b reads/updates slab row slot_ids[b] in place (ids in range and DISTINCT per call, the caller's contract); absent keeps state row b. |
cdist | Pairwise L_p distance between every ROW pair of two matrices. |
ceil | Elementwise ceiling: the smallest integer not below x. |
ceil_ | In-place ceil: writes the result through self; same formula, arguments, and error conditions as ceil(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
celu | Continuously differentiable exponential linear unit. |
celu_ | In-place celu: writes the result through self; same formula, arguments, and error conditions as celu(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
chunk | Split along dim into num_chunks near-equal parts (the last may be shorter). Returns VIEWS sharing the source's storage (one call, no copy); prefer it over repeated narrows. |
circular_pad | pad in wrap-around mode: the padding continues from the opposite edge. Same (lo, hi) pair layout as constant_pad. Copies. |
clamp | Clamp x into [min, max]; an empty bound leaves that side unbounded. |
clamp_ | In-place clamp: writes the result through self; same formula, arguments, and error conditions as clamp(). Either bound may be absent (std::nullopt), a one-sided clamp; tensor bounds broadcast against self. A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
clamp_max | Elementwise upper bound. |
clamp_max_ | In-place clamp_max: writes the result through self; same formula, arguments, and error conditions as clamp_max(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
clamp_min | Elementwise lower bound. |
clamp_min_ | In-place clamp_min: writes the result through self; same formula, arguments, and error conditions as clamp_min(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
clone | Deep copy on the same device: fresh storage, identical shape, dtype, and values. Equivalent to copy(src) with the defaults. |
concat | Join tensors along an EXISTING dim: all inputs share rank and off-dim extents; the dim extents add up. Copies into fresh storage. |
constant_pad | pad with a constant fill. |
contiguous | Packs the tensor into row-major contiguous storage. |
conv | Convolution family, channels-last ([N, spatial..., C]), weights output-channel-first ([O, spatial..., Ig]). stride / dilation / output_padding are PER-AXIS window attributes everywhere: length 0 (defaulted), 1 (broadcast), or spatial-rank. padding carries TWO conventions; read the one that matches the op:conv / conv_transpose*: interleaved (lo, hi) PAIRS in axis order (even length; pair i pads spatial axis i); asymmetric pads spell directly, e.g. 1-D {2, 3} = lo 2, hi 3. conv1d/2d/3d: SYMMETRIC per-axis widths (length 0/1/spatial-rank), e.g. 1-D {2} = lo 2, hi 2; an asymmetric pad needs conv or an explicit ops::pad first. The inline defaults below encode the split: conv1d pads {0}, conv_transpose1d pads {0, 0}. |
conv1d | 1-D convolution over a channels-last input. |
conv2d | 2-D convolution over a channels-last input. |
conv3d | 3-D convolution over a channels-last input. |
conv_transpose | Rank-polymorphic (1-D/2-D/3-D) transposed (fractionally-strided) convolution (learnable upsampling). |
conv_transpose1d | 1-D transposed (fractionally-strided) convolution (learnable upsampling). |
conv_transpose2d | 2-D transposed (fractionally-strided) convolution (learnable upsampling). |
conv_transpose3d | 3-D transposed (fractionally-strided) convolution (learnable upsampling). |
copy | Copies a tensor, optionally to another device or stream. |
copy_ | Copies src INTO self's existing storage, converting per element to self's dtype in the same single pass (never cast first; the copy IS the cast). Shapes must match after broadcasting src. Raises ClikaRT::Error where the shapes/dtypes cannot be served; returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
copy_into | Write src into the caller-supplied out buffer (the destination-first spelling of the in-place copy; bind a persistent buffer once, write it every step with no allocation). Dtype conversion is interleaved with the write; a cross-device src is transferred first. Returns out. |
copy_to_cpu | Materializes a host-resident copy of the tensor (device-to-host transfer; an owning CPU tensor even when src is already on the CPU). |
copysign | Elementwise ` |
copysign_ | In-place copysign: writes the re-signed magnitudes through x. ClikaRT::Error as the value form. |
cos | Elementwise cosine. |
cos_ | In-place cos: writes the result through self; same formula, arguments, and error conditions as cos(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
cosh | Elementwise hyperbolic cosine. |
cosh_ | In-place cosh: writes the result through self; same formula, arguments, and error conditions as cosh(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
cosine_similarity | Cosine similarity along dim. |
count_nonzero | Number of nonzero elements over dims. |
cross | 3-vector cross product along dim. |
cross_entropy | Cross-entropy loss over class LOGITS; the class dim is LAST. |
cummax | a 2-element array {values, indices}. |
cummin | a 2-element array {values, indices}. |
cumprod | Cumulative product along dim (inclusive scan). |
cumprod_ | In-place cumprod: rewrites self with its inclusive prefix products along dim and returns it under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. ClikaRT::Error as cumprod. |
cumsum | Cumulative sum along dim (inclusive scan). |
cumsum_ | In-place cumsum: rewrites self with its inclusive prefix sums along dim and returns it under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. ClikaRT::Error as cumsum. |
deform_conv | Deformable convolution, 1-D/2-D/3-D (rank derives from x), channels-last: x [N, D1..Dr, C], weight [O, K1..Kr, C/groups] (OHWI), offset [N, out-spatial..., offset_groups·∏K·r], mask [N, out-spatial..., offset_groups·∏K] (absent ⇒ unmodulated), bias [O]; returns [N, out-spatial..., O] at x's dtype. Each kernel tap samples at out·stride − pad_lo + tap·dilation + Δ (pixel units, bilinear; out-of-bounds reads 0); the offset channel for (group g, tap t, axis d) is (g·∏K + t)·r + d with taps row-major over the kernel and axes in layout order (2-D: Δh then Δw). padding is interleaved (lo, hi) pairs over the spatial axes; stride/dilation broadcast per spatial axis (empty ⇒ 1). All floating inputs must share x's dtype (f32/f64/f16/bf16; no silent promotion); activation is a fused elementwise epilogue applied after bias. |
deg2rad | Converts degrees to radians elementwise: . x's shape at its (float-promoted) dtype. ClikaRT::Error (INVALID_ARGUMENT) for an unsupported dtype. |
deg2rad_ | In-place deg2rad: writes the radians through x. ClikaRT::Error as the value form. |
dequantize | |
dequantize_ | |
diag | Rank-1 <-> rank-2 diagonal converter. |
diag_embed | Embed the LAST dim along the diagonal of a fresh (dim1, dim2) plane: output rank = input rank + 1, both new dims sized `last + |
diagonal | Extract the offset-th diagonal between dim1 and dim2: the two source dims are removed and a trailing dim of the diagonal's length is appended (rank - 1 total). Copies into fresh storage (deliberately not a view). |
diff | n-th order finite difference along dim. |
div (2 overloads) | Divides a by other elementwise, with an optional quotient rounding. |
div_ | In-place div: writes the (optionally rounded) quotient through x. ClikaRT::Error as the value form. |
dot | Inner product of two 1-D tensors. |
dynamic_quantize | |
einsum | Einstein-summation contraction from a notation string. |
elu | Exponential linear unit. |
elu_ | In-place elu: writes the result through self; same formula, arguments, and error conditions as elu(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
embedding | Embedding lookup: gathers rows of weight by indices, with an optional bias + activation epilogue. |
empty | Uninitialized tensor of the given shape; the contents are whatever the allocator hands back; write every element before reading any. |
empty_like | Uninitialized tensor with reference's shape and dtype. |
empty_strided | Uninitialized tensor with caller-chosen sizes AND strides (element units). |
eq | Elementwise equality a == other, the output contract the whole comparison family shares: the result is a Bool tensor at the broadcast shape (operands promote to their dominant dtype before the compare). A scalar other compares against every element. The other comparisons state "output as `eq`" instead of restating this. the broadcast-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. auto hits = ClikaRT::ops::eq(ids, pad_id); // Bool mask |
eq_ | In-place eq: writes the comparison result through x (x keeps its own dtype; true/false land as one/zero). ClikaRT::Error as the value form. |
erf | Elementwise Gauss error function. |
erf_ | In-place erf: writes the result through self; same formula, arguments, and error conditions as erf(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
erfc | Elementwise complementary error function. |
erfc_ | In-place erfc: writes the result through self; same formula, arguments, and error conditions as erfc(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
erfinv | Elementwise inverse error function. |
erfinv_ | In-place erfinv: writes the result through self; same formula, arguments, and error conditions as erfinv(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
exp | Elementwise natural exponential. |
exp_ | In-place exp: writes the result through self; same formula, arguments, and error conditions as exp(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
expand | Broadcast x to a larger shape WITHOUT copying. |
expand_as | expand to other's shape; other supplies extents only; its data is never read. Same broadcasting rules and view semantics as expand. |
exponential_ | In-place exponential fill with rate lambd: overwrites self with draws from p(x) = lambd * exp(-lambd * x) (x >= 0) and returns it under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
eye | A 2-D identity matrix [n, m]: 1 on the diagonal, 0 elsewhere; m defaults to n (square). |
fast_gelu | FastGELU: the tanh GELU approximation as a standalone op. |
fill | A new tensor with x's shape and dtype, every element set to value. |
fill_ | In-place fill: overwrites every element of self with value; same arguments and error conditions as fill(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
fill_diagonal | A copy of the 2-D matrix x with fill_value written along its diagonal. |
fill_diagonal_ | In-place fill_diagonal: writes the diagonal through self; same arguments and error conditions as fill_diagonal(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
flatten | Collapse the INCLUSIVE dim range [start_dim, end_dim] into one dim; the defaults collapse everything to 1-D. |
flip | Reverse the element order along each dim in dims. |
fliplr | flip on dim 1: reverse each row's column order. Input rank must be >= 2. Copies. |
flipud | flip on dim 0: reverse the leading dim's order. Copies. |
floor | Elementwise floor: the largest integer not above x. |
floor_ | In-place floor: writes the result through self; same formula, arguments, and error conditions as floor(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
floor_divide | Elementwise floor(a / other), i.e. ops::div with RoundingMode::Floor. Broadcasts and promotes as add. the broadcast-shaped floored quotient. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
floor_divide_ | In-place floor_divide: writes the floored quotient through x. ClikaRT::Error as the value form. |
fmax | Elementwise IEEE 754 maximum, NaN-IGNORING: where one operand is NaN the other value wins (both NaN gives NaN). For the NaN-propagating law use ops::maximum. Broadcasts and promotes as add. the broadcast-shaped maxima. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
fmin | Elementwise IEEE 754 minimum, NaN-IGNORING (the fmax dual). Broadcasts and promotes as add. the broadcast-shaped minima. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
fmod | Elementwise remainder with the sign of the DIVIDEND, i.e. ops::mod with ModMode::C. Broadcasts and promotes as add. the broadcast-shaped remainders. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
fmod_ | In-place fmod: writes the remainders through x. ClikaRT::Error as the value form. |
fold | col2im: the inverse of unfold; it sums overlapping windows back into a channels-last image. |
frac | Elementwise fractional part. |
frac_ | In-place frac: writes the result through self; same formula, arguments, and error conditions as frac(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
frexp | Decomposes each element into mantissa * 2^exponent with ` |
from_blob | Wrap caller-owned memory as a Tensor (no copy, no allocation). |
full | A new tensor of the given shape with every element set to fill_value. |
full_like | A new tensor with reference's shape and dtype, filled with fill_value. |
gated_delta_update | Gated delta-rule recurrence step: per token, the [B, HV, K, V] Float32 state decays by exp(g), takes the delta-rule rank-1 update (beta·k) ⊗ (v − Sᵀk), and emits o = (scale·q)ᵀ S, updated IN PLACE. The gate's RANK picks the family: [B, T, HV] = one scalar per value head; [B, T, HV, K] = per key dim. q/k [B, T, H, K] (HV % H == 0, grouped heads), v [B, T, HV, V], beta [B, T, HV]; scale defaults to K^-1/2; seq_lens ([B] Int32) bounds ragged prefill rows. slot_ids ([B] Int32, device-resident) addresses state as a SLAB [num_slots, HV, K, V]: batch row b reads/updates slab row slot_ids[b] in place (ids in range and DISTINCT per call, the caller's contract); absent keeps state row b. TWO gate forms, told apart by which inputs are bound: with gate_bias and gate_scale absent, g IS the log-space decay (Float32 or the activations' dtype); with both bound (Float32 gate_bias [HV] beside a [B, T, HV] gate or [HV, K] beside a [B, T, HV, K] one, the checkpoint's dt_bias; Float32 gate_scale [HV], the once-folded -exp(A_log)), g is the RAW gate projection slice at the activations' dtype and the kernel forms the decay gate_scale * softplus(g + gate_bias) in fp32 registers, so no add / softplus / mul pass and no fp32 transient precede the call. One without the other rejects; a backend without the raw-gate arm declines it typed. |
gated_rms_norm | Fused group RMS norm + post-norm silu(z) gate: out = rms_norm(x) · silu(z), the norm taken over the trailing normalized_shape group extent ({vd} for a per-head norm over [.., HV, vd]). weight is the optional [group] gamma applied after the normalization; an absent eps takes the runtime's rms-norm default. |
gather | Axis-wise gather: read x at positions given by index along dim. |
ge | Elementwise a >= other; output as eq. the broadcast-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
ge_ | In-place ge: writes the result through x (one/zero at x's dtype). ClikaRT::Error as the value form. |
geglu | GeGLU gated activation over a concatenated gate‖up tensor. |
gelu | Gaussian error linear unit. |
gelu_ | In-place gelu: writes the result through self; same formula, arguments, and error conditions as gelu(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
generate_rotary_cache | a 2-element array {values, indices}. |
glu | Gated linear unit: splits x in half along dim and gates the first half with the sigmoid of the second. |
grid_sample | Samples a channels-last input at arbitrary grid coordinates. |
group_norm | Group normalization: channels split into num_groups groups, normalized per group (channels-last). |
group_query_attention | Fused GQA with RoPE + KV cache. Bind out_present_key/out_present_value to the same buffers as past_key/past_value (a KVCache::keys/values(layer) view) + pass kvcache_start to append the new post-RoPE K/V IN PLACE into the cache (the decode perf path). q/k/v are hidden-folded [ΣS, heads*head_dim]; num_heads/kv_num_heads drive the in-op head split (GQA). head_sink is the per-head softmax sink [H_q], a virtual logit folded into the softmax denominator (attention-sink models bind one per layer), the same contract as the varlen face; it rides the parameter tail here. q_norm_gain/k_norm_gain engage the POST-rope per-head RMS norm: after the in-op rotation, every head's [head_dim] q (and new-k) vector is RMS-normalized with the gain BEFORE any cache append, so the cache holds rotated+normed keys. Each gain is rank-1 [head_dim] (one vector shared across heads; any other shape rejects), any float dtype, applied at its own dtype. The gains require the in-op rope planes (rope_cos/rope_sin), and they travel WITH qk_norm_eps: pass the model's own rms-norm epsilon alongside the gains, or neither (a gain without the epsilon, or an epsilon with no gain, rejects). Absent ⇒ the gain-less path, unchanged. A rope-free per-head norm composes qk_rms_norm instead. slot_ids ([B] Int32) names the cache row each batch row appends to and attends from on a continuous [max_seqs, H_kv, max_seq, D] cache: a sequence keeps its row while the batch composition changes around it. Absent, batch row b uses cache row b. Every entry must lie in [0, max_seqs) and no two rows may share one (each rejects). On that cache kvcache_start stays the rank-1 [B] layout selector whose values are not read: each row's write offset is cu_seqlens_k[b] - q_len[b]. A paged block table and the dense in-place form take no slot_ids (the block table is its own row map; the dense form addresses rows by batch index). {out_attn, present_key, present_value}. |
group_query_attention_varlen | The varlen face of the fused GQA above, with the same qk-norm tail: q_norm_gain/k_norm_gain (rank-1 [head_dim], post-rope, applied before the K/V append) travel with qk_norm_eps (the model's rms-norm epsilon) and require the in-op rope planes; absent ⇒ unchanged. The same slot_ids contract: on a continuous cache it names each batch row's cache row ([B] Int32, in range, pairwise distinct; absent = row b for batch row b), and kvcache_start's values stay unread there (the write offsets derive from cu_seqlens_k). |
gt | Elementwise a > other; output as eq. the broadcast-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
gt_ | In-place gt: writes the result through x (one/zero at x's dtype). ClikaRT::Error as the value form. |
hardshrink | Hard shrinkage: zeroes every element within [-lambd, lambd]. |
hardshrink_ | In-place hardshrink: writes the result through self; same formula, arguments, and error conditions as hardshrink(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
hardsigmoid | Piecewise-linear sigmoid approximation. |
hardsigmoid_ | In-place hardsigmoid: writes the result through self; same formula, arguments, and error conditions as hardsigmoid(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
hardswish | Piecewise-linear swish approximation (the MobileNet-v3 form). |
hardswish_ | In-place hardswish: writes the result through self; same formula, arguments, and error conditions as hardswish(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
hardtanh | Clamps every element to [min_val, max_val]. |
hardtanh_ | In-place hardtanh: writes the result through self; same formula, arguments, and error conditions as hardtanh(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
hash_128 | 128-bit sibling of hash_64; same byte/portability contract. [2] UInt64 (little-endian limb order). ClikaRT::Error when the input's dtype is not served for this operation (the machine-readable reason rides code_name()). |
hash_256 | 256-bit sibling of hash_64; same byte/portability contract. [4] UInt64 (little-endian limb order). ClikaRT::Error when the input's dtype is not served for this operation (the machine-readable reason rides code_name()). |
hash_64 | 64-bit content hash of x's packed bytes (row-major logical order; strided inputs are materialized internally). A frozen function of (seed, bytes): identical on every platform, backend, and ISA tier, so digests are safe to persist and compare across devices. seed perturbs the key; 0 selects the runtime's fixed content-addressing key. |
hash_chain | Rowwise 128-bit CHAINED hash: for rows [N, ..] and a [2] UInt64 parent (zeros = the chain's zero element), row i's digest hashes (digest i-1 ‖ row i's packed bytes); one dispatch computes a whole sequence's rolling content hashes. Same portability contract as hash_64. |
hash_tensor | Bitwise hash-reduction over dims (empty = all): each element's bits are mixed and combined per mode into a UInt64 digest, standard reduction shape. Order-independent under HashTensorMode::XorSum, and identical on every backend, a cheap whole-tensor fingerprint for parity checks and cache keys. |
histogram | a 2-element array {values, indices}. |
huber_loss | Huber loss: quadratic near zero, linear past the delta knee. |
hypot | Elementwise hypotenuse . Broadcasts and promotes as add. the broadcast-shaped result at the promoted float dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
hypot_ | In-place hypot: writes the hypotenuses through x. ClikaRT::Error as the value form. |
index | Advanced indexing over the standard entry vocabulary (int / bool / integer-or-boolean Tensor / IndexSlice / ellipsis / new_axis): index(t, {1, slice_all, idx}) ≡ t[1, :, idx]. |
index_add | A copy of x with rows of src ACCUMULATED at indices along dim: out[.., indices[i], ..] += src[.., i, ..]; duplicate indices add up. |
index_add_ | In-place index_add: self[.., indices[i], ..] += src[.., i, ..]; same arguments and error conditions as index_add(). Accumulates through self's storage (a strided view reaches its base buffer; aliases observe the write). Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
index_copy | A copy of x with rows of src WRITTEN at indices along dim: out[.., indices[i], ..] = src[.., i, ..]. Prefer unique indices; a duplicated position is written more than once. |
index_copy_ | In-place index_copy: self[.., indices[i], ..] = src[.., i, ..]; same arguments and error conditions as index_copy(). Writes through self's storage (a strided view, e.g. a cache slice, reaches its base buffer; aliases observe the write). Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
index_fill | A copy of x with the rows at indices along dim set to value: out[.., indices[i], ..] = value. |
index_fill_ | In-place index_fill: self[.., indices[i], ..] = value; same arguments and error conditions as index_fill(). Fills through self's storage (a strided view reaches its base buffer; aliases observe the write). Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
index_put | A copy of x with value written (or accumulated) at the indexed positions, the out-of-place x[indices] = value. |
index_put_ | In-place self[indices] = value (or += with accumulate); returns the mutated self so it chains. |
index_select | Select whole rows of x at index positions along dim. |
inner | Last-axis contraction of two tensors. |
instance_norm | Instance normalization: statistics per (sample, channel) over the spatial dims (channels-last). |
interpolate | Resample the spatial dims to sizes OR by scale_factors (exactly one given; entries may be int literals or 0-D Tensors, so a dynamic output size flows without a host read). Rank picks the spatial variant. |
isclose | Elementwise approximate equality, the elementwise map behind ops::allclose, same formula and defaults (rtol 1e-5, atol 1e-8, equal_nan false). the broadcast-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
isfinite | Elementwise finiteness test (neither infinite nor NaN); output as eq. Integer inputs are finite everywhere. x-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) for an unsupported dtype. |
isinf | Elementwise infinity test (either sign); output as eq. x-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) for an unsupported dtype. |
isnan | Elementwise NaN test; output as eq. x-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) for an unsupported dtype. |
isneginf | Elementwise -inf test; output as eq. x-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) for an unsupported dtype. |
isposinf | Elementwise +inf test; output as eq. x-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) for an unsupported dtype. |
kl_div | Kullback–Leibler divergence loss. |
kron | Kronecker product of two same-rank tensors. |
kthvalue | a 2-element array {values, indices}. |
l1_loss | Mean-absolute-error loss between input and target. |
layer_norm | Layer normalization over the trailing normalized_shape dims of x. |
le | Elementwise a <= other; output as eq. the broadcast-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
le_ | In-place le: writes the result through x (one/zero at x's dtype). ClikaRT::Error as the value form. |
leaky_relu | ReLU with a small slope on the negative side. |
leaky_relu_ | In-place leaky_relu: writes the result through self; same formula, arguments, and error conditions as leaky_relu(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
linear | x @ weightᵀ (+ bias); weight in the [out, in] Linear layout. Same situ contract as matmul: Activation::Situ transforms both halves of the gate‖up projection under the two soft-caps (situ_beta = β, situ_linear_beta = lβ, both > 0, from the model's config); either scalar with any other activation rejects. |
linspace | steps evenly spaced values from start to end, ENDPOINTS INCLUDED. |
log | Elementwise natural logarithm. |
log10 | Elementwise base-10 logarithm. |
log10_ | In-place log10: writes the result through self; same formula, arguments, and error conditions as log10(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
log1p | Elementwise log(1 + x), accurate for small x. |
log1p_ | In-place log1p: writes the result through self; same formula, arguments, and error conditions as log1p(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
log2 | Elementwise base-2 logarithm. |
log2_ | In-place log2: writes the result through self; same formula, arguments, and error conditions as log2(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
log_ | In-place log: writes the result through self; same formula, arguments, and error conditions as log(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
log_sigmoid | Logarithm of the sigmoid, computed stably. |
log_sigmoid_ | In-place log_sigmoid: writes the result through self; same formula, arguments, and error conditions as log_sigmoid(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
log_softmax | Logarithm of the softmax along dim, computed stably (never log(softmax(x)) in two passes). |
log_softmax_ | In-place log_softmax: writes the result through self; same formula, arguments, and error conditions as log_softmax(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
logaddexp | Elementwise , computed overflow-safely (the log-domain accumulation primitive). Broadcasts and promotes as add. the broadcast-shaped result at the promoted float dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
logaddexp2 | Elementwise , logaddexp in base 2. Broadcasts and promotes as add. the broadcast-shaped result at the promoted float dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
logical_and | Elementwise logical AND; non-Bool inputs read as element != 0 before the logic, and the output is always Bool (output as eq). the broadcast-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
logical_and_ | In-place logical_and: writes the result through x (one/zero at x's dtype). ClikaRT::Error as the value form. |
logical_not | Elementwise logical NOT (element == 0); output as eq. x-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) for an unsupported dtype. |
logical_not_ | In-place logical_not: writes the result through x (one/zero at x's dtype). ClikaRT::Error as the value form. |
logical_or | Elementwise logical OR (non-Bool inputs read as != 0); output as eq. the broadcast-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
logical_or_ | In-place logical_or: writes the result through x (one/zero at x's dtype). ClikaRT::Error as the value form. |
logical_xor | Elementwise logical XOR (non-Bool inputs read as != 0); output as eq. the broadcast-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
logical_xor_ | In-place logical_xor: writes the result through x (one/zero at x's dtype). ClikaRT::Error as the value form. |
logit | Elementwise log-odds. |
logit_ | In-place logit: writes the result through self; same formula, arguments, and error conditions as logit(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
logsumexp | Numerically stable log(sum(exp(x))) over dims. |
lt | Elementwise a < other; output as eq. the broadcast-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
lt_ | In-place lt: writes the result through x (one/zero at x's dtype). ClikaRT::Error as the value form. |
masked_fill | Replace the elements of x where mask is true with value. |
masked_fill_ | In-place masked_fill: writes value through self where mask is true; same arguments and error conditions as masked_fill(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
masked_scatter | A copy of x with the leading count(mask) elements of src (read row-major) written at the positions where mask is true. |
masked_scatter_ | In-place masked_scatter: writes src's leading elements through self where mask is true; same arguments and error conditions as masked_scatter(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
masked_select | The elements of x where mask is true, as a 1-D tensor. |
matmul | a @ b (+ bias) with an optional fused activation epilogue. A gated activation (SwiGlu/GeGlu/ReGlu/Situ) takes the product as a concatenated [*, 2d] gate‖up projection and emits [*, d] in one pass. situ_beta/situ_linear_beta are Activation::Situ's two soft-cap scalars (β and lβ in β·tanh(gate/β)·sigmoid(gate) · lβ·tanh(up/lβ)); pass the model's own config values. Situ requires BOTH > 0, and either scalar with any other activation rejects (it would otherwise be silently ignored). The transform computes at fp32 end-to-end with one demote at the store for f16/bf16 outputs. |
max | a 2-element array {values, indices}. |
max_pool | Rank-generic max pooling, channels-last. |
max_pool1d | 1-D max pooling over [N, L, C] (channels-last). See max_pool for the window semantics; stride empty = kernel_size. |
max_pool1d_with_indices | a 2-element array {values, indices}. |
max_pool2d | 2-D max pooling over [N, H, W, C] (channels-last). |
max_pool2d_with_indices | a 2-element array {values, indices}. |
max_pool3d | 3-D max pooling over [N, D, H, W, C] (channels-last). See max_pool2d; parameters extend to {kD, kH, kW} etc. |
max_pool3d_with_indices | a 2-element array {values, indices}. |
max_pool_with_indices | a 2-element array {values, indices}. |
maximum | Elementwise maximum, NaN-PROPAGATING: a NaN in either operand yields NaN (use ops::fmax for the NaN-ignoring IEEE law). Broadcasts and promotes as add. the broadcast-shaped maxima. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
maximum_ | In-place maximum: writes the elementwise maxima through x. ClikaRT::Error as the value form. |
mean | Arithmetic mean of x over dims. |
median | a 2-element array {values, indices}. |
meshgrid | Coordinate grids from 1-D axes: N inputs produce N N-D tensors, each input broadcast over every other axis, the NumPy meshgrid. |
min | a 2-element array {values, indices}. |
minimum | Elementwise minimum, NaN-PROPAGATING (the maximum dual; use ops::fmin for NaN-ignoring). Broadcasts and promotes as add. the broadcast-shaped minima. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
minimum_ | In-place minimum: writes the elementwise minima through x. ClikaRT::Error as the value form. |
mish | Mish activation. |
mish_ | In-place mish: writes the result through self; same formula, arguments, and error conditions as mish(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
mla_attention | Multi-head Latent Attention over a compressed KV cache, latent-space end to end: q_nope [ΣS, H, Dl] (W_UK-absorbed) + q_pe [ΣS, H, Dr] score against the per-token compressed rows; the caches ([max_seqs, max_seq, Dl/Dr]) take this step's new_ckv/new_kpe appends IN PLACE (write offsets = kvcache_start [B] Int32; cu_seqlens_q [B+1] locates each sequence's packed tokens); the returned [ΣS, H, Dl] output stays latent (apply the W_UV un-absorption after). scale is REQUIRED; the absorbed query's magnitude lives in the model's un-absorbed head dim. |
mm | Matrix multiply of two rank-2 tensors, with an optional fused bias and activation epilogue. |
mod | Elementwise modulo with a selectable sign convention. |
mod_ | In-place mod: writes the remainders through x. ClikaRT::Error as the value form. |
moe | Fused Mixture-of-Experts layer: route, run the top-k experts, combine in one call, with no per-expert dispatch from the caller. |
mrope_rotary_embedding | Multi-section rotary position embedding over padded layouts. |
mrope_rotary_embedding_qk_varlen | Multi-axis RoPE over a packed q/k pair: ONE per-token angle table serves both projections in a single call, the media-prefill pre-rotation shape. q/k are head-exposed [n_tokens, heads, head_dim] (a flat [n_tokens, heads·head_dim] projection reshapes to it as a free view; the rotation spans the TRAILING dim, so a flat row would rotate across head boundaries); position_ids is [n_axes, n_tokens] with n_axes == mrope_sections.size() (strip any trailing zero sections a checkpoint's metadata pads; the axis count follows the section list); rotary_dim bounds the rotated span (dims beyond it pass through) and defaults to the trailing dim. Rows whose per-axis positions are all EQUAL rotate exactly as the plain ops do; serve pure-text calls through rotary_embedding* (cheaper: no per-token table), and use this form for packs whose rows carry genuinely multi-axis positions, then attend with the rope inputs ABSENT so the attention op consumes (and appends) q/k exactly as given. a 2-element array {q, k}. |
mrope_rotary_embedding_varlen | Multi-section rotary position embedding over token-packed layouts (cu_seqlens [B+1] Int32, as in rotary_embedding_varlen). |
ms_deform_attention | Multi-scale deformable attention (2-D): per query and head, gather P bilinear samples from each of L flattened feature-map levels and combine them with the given weights. value [N, S, M, D] with S = Σ_l H_l·W_l; spatial_shapes [L, 2] = per-level (H_l, W_l) and level_start_index [L] (both Int32 or Int64); sampling_locations [N, Lq, M, L, P, 2]; last dim (x, y), normalized to [0, 1] per level, sampled at loc·size − 0.5 (bilinear; out-of-bounds reads 0); attention_weights [N, Lq, M, L, P] are consumed AS GIVEN (apply softmax beforehand if wanted). Returns [N, Lq, M, D] at value's dtype; accumulation is fp32. The float inputs must share value's dtype (f32/f64/f16/bf16; no silent promotion). |
mse_loss | Mean-squared-error loss between input and target. |
mul (2 overloads) | Multiplies a by other elementwise. |
mul_ | In-place mul: writes through x. ClikaRT::Error as the value form. |
multinomial | Categorical sampling: draws num_samples category indices per row of a weight tensor. |
mv | Matrix-vector multiply, with an optional fused bias and activation. |
nan_to_num | Replaces NaN and infinities with finite values. |
nan_to_num_ | In-place nan_to_num: writes the result through self; same formula, arguments, and error conditions as nan_to_num(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
nanmean | Mean over dims, treating NaN entries as missing. |
nanmedian | a 2-element array {values, indices}. |
nanquantile | quantile that treats NaN entries as missing; each slice's quantile is computed over its non-NaN values (an all-NaN slice yields NaN). Parameters and shapes as quantile. |
nansum | Sum over dims, treating NaN entries as missing (contributing zero). |
narrow | length elements from start along dim. Both are int literals or 0-D integer Tensors (a tensor-valued window never syncs to the host). |
ndim | The tensor's rank as a 0-D Int64 tensor. |
ndim_host | The rank as a 0-D Int64 HOST tensor, written from metadata; the same no-sync contract as shape_host. |
ne | Elementwise a != other; output as eq. the broadcast-shaped Bool mask. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
ne_ | In-place ne: writes the result through x (one/zero at x's dtype). ClikaRT::Error as the value form. |
neg | Elementwise negation. |
neg_ | In-place neg: writes the result through self; same formula, arguments, and error conditions as neg(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
nll_loss | Negative-log-likelihood loss over LOG-probabilities; class dim LAST. |
nms | Batched, class-aware non-max suppression (argument order mirrors the ONNX operator). boxes is [batch, num_boxes, 4]; scores is [batch, classes, num_boxes]; returns the selected indices as an Int64 [num_selected, 3] of (batch, class, box) rows. Every threshold takes a literal OR a 0-D tensor (a tensor traces symbolically). An absent max_output_boxes_per_class selects NOTHING (the reference default); a negative cap clamps to 0. A literal iou_threshold outside [0, 1] raises. center_point_box picks the [cx, cy, w, h] box encoding over the corners form. |
nonzero | Coordinates of the nonzero elements: an [n, ndim] Int64 matrix, one row per nonzero element of x. |
norm | The p-norm of x over dims. |
normal | Normal draws with the given mean and standard deviation. |
normal_ | In-place normal fill: overwrites self with N(mean, stddev^2) draws at self's shape/dtype and returns it under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. ClikaRT::Error as normal. |
normalize | L_p-normalizes x along dim: each slice is scaled to unit p-norm. |
normalize_ | In-place normalize: rewrites self with its L_p-normalized value and returns it under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. ClikaRT::Error as normalize. |
numel | The tensor's total element count as a 0-D Int64 tensor. |
numel_host | The element count as a 0-D Int64 HOST tensor, written from metadata; the same no-sync contract as shape_host. Composes with shape-consuming arguments, e.g. reshape(x, {numel_host(x)}) flattens without reading sizes to the host. |
one_hot | Expands an integer index tensor into a trailing one-hot dimension. |
ones | A new tensor of the given shape with every element set to one. |
ones_like | A one-filled tensor with reference's shape and dtype (data never read); s absent = the reference's own device. |
outer | Outer product of two 1-D tensors: [m] x [n] -> [m, n]. |
pad | Pad each axis by interleaved (lo, hi) pairs in layout order, left-to-right: pair i pads axis i (the first pair is the leading axis). Provide fewer pairs than the rank to pad only the leading axes; a negative width crops that side. mode selects the fill; value is the Constant fill (default 0). |
pairwise_distance | Row-wise L_p distance between two batched vectors. |
pdist | Condensed pairwise L_p distances within ONE 2-D input. |
permute | Reorder the dims by dims, a permutation of [0, rank). |
pixel_shuffle | Rearranges channels into space (depth-to-space): channels-last [N, H, W, C] becomes [N, H*r, W*r, C/r^2]. |
pixel_unshuffle | The inverse of pixel_shuffle (space-to-depth): channels-last [N, H, W, C] becomes [N, H/r, W/r, C*r^2]. |
poisson | Independent Poisson draws from per-element rates. |
pow | Raises a to exponent elementwise: . Broadcasts and promotes as add; a scalar exponent keeps its weak kind (an integer exponent with an integer base stays integral). the broadcast-shaped powers at the promoted dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
pow_ | In-place pow: writes the powers through x. ClikaRT::Error as the value form. |
prelu | Parametric ReLU: a learned negative-side slope. |
prelu_ | In-place prelu: writes the result through self; same formula, arguments, and error conditions as prelu(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
prod | Product of x's elements over dims. |
put | A copy of x with source written at FLAT (row-major linearized) positions: out.flat[index[i]] = source.flat[i]. |
put_ | In-place put: writes (or accumulates) through self at flat positions; same arguments and error conditions as put(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
q_embedding | |
qadd (2 overloads) | |
qadd_ (3 overloads) | |
qconcat (2 overloads) | |
qconcat_ (2 overloads) | |
qconv (2 overloads) | |
qconv1d (2 overloads) | |
qconv1d_woq | |
qconv2d (2 overloads) | |
qconv2d_woq | |
qconv3d (2 overloads) | |
qconv3d_woq | |
qconv_ (3 overloads) | |
qconv_transpose (2 overloads) | |
qconv_transpose1d (2 overloads) | |
qconv_transpose1d_woq | |
qconv_transpose2d (2 overloads) | |
qconv_transpose2d_woq | |
qconv_transpose3d (2 overloads) | |
qconv_transpose3d_woq | |
qconv_transpose_ (3 overloads) | |
qconv_transpose_woq | |
qconv_woq | |
qdeform_conv (2 overloads) | |
qdeform_conv_woq | |
qdiv (2 overloads) | |
qdiv_ (3 overloads) | |
qfast_gelu (2 overloads) | |
qfast_gelu_ (3 overloads) | |
qgelu (2 overloads) | |
qgelu_ (3 overloads) | |
qhardswish (2 overloads) | |
qhardswish_ (3 overloads) | |
qk_layer_norm | Per-head LAYER norm over packed attention projections, the mean-subtracting sibling of qk_rms_norm. |
qk_layer_norm_ | In-place qk_layer_norm: normalizes q (and k, when present) through their own storage (no output allocation); v is untouched. Same arguments and error conditions as qk_layer_norm(). Tensors are shared-storage handles, so the caller's operands see the writes. Returns q under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
qk_rms_norm | Per-head RMS norm over packed attention projections: q, k and v in ONE call, no reshapes. |
qk_rms_norm_ | In-place qk_rms_norm: normalizes q (and k, when present) through their own storage (no output allocation); v is untouched. Same arguments and error conditions as qk_rms_norm(). Tensors are shared-storage handles, so the caller's operands see the writes. Returns q under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
qleaky_relu (2 overloads) | |
qleaky_relu_ (3 overloads) | |
qlinear (2 overloads) | |
qlinear_ (2 overloads) | |
qlinear_woq | |
qlinear_woq_ | |
qmatmul (2 overloads) | |
qmatmul_ (3 overloads) | |
qmatmul_woq | |
qmatmul_woq_ | |
qmoe (2 overloads) | |
qmoe_woq | |
qmul (2 overloads) | |
qmul_ (3 overloads) | |
qquick_gelu (2 overloads) | |
qquick_gelu_ (3 overloads) | |
qrelu (2 overloads) | |
qrelu_ (3 overloads) | |
qsigmoid (2 overloads) | |
qsigmoid_ (3 overloads) | |
qsilu (2 overloads) | |
qsilu_ (3 overloads) | |
qsub (2 overloads) | |
qsub_ (3 overloads) | |
qtanh (2 overloads) | |
qtanh_ (3 overloads) | |
quantile | The q-th quantile of x along dim. |
quantize | |
quantize_ (2 overloads) | |
quantize_dequantize | |
quantize_to_scheme | |
quick_gelu | QuickGELU: the sigmoid GELU approximation. |
rad2deg | Converts radians to degrees elementwise: . x's shape at its (float-promoted) dtype. ClikaRT::Error (INVALID_ARGUMENT) for an unsupported dtype. |
rad2deg_ | In-place rad2deg: writes the degrees through x. ClikaRT::Error as the value form. |
rand | Uniform random tensor on [0, 1). |
rand_like | Uniform [0, 1) draws shaped and typed like reference. |
randint | Uniform random integers in the half-open range [low, high). |
randint_like | Uniform integers in [low, high) shaped and typed like reference. |
randn | Standard-normal random tensor, N(0, 1). |
randn_like | N(0, 1) draws shaped and typed like reference. |
random_ | In-place uniform-INTEGER fill: overwrites self with draws from [low, high). low and high come both or neither; with both absent, the range is the dtype's full representable-integer span. A view input writes through its base storage. Returns self for chaining. |
randperm | A random permutation of the integers 0 .. n-1. |
reciprocal | Elementwise reciprocal. |
reciprocal_ | In-place reciprocal: writes the result through self; same formula, arguments, and error conditions as reciprocal(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
reflect_pad | pad in mirror mode: the padding reflects the tensor across each padded edge. Same (lo, hi) pair layout as constant_pad. Copies. |
reglu | ReGLU gated activation over a concatenated gate‖up input. |
relu | Rectified linear unit. |
relu6 | ReLU capped at 6. |
relu6_ | In-place relu6: writes the result through self; same formula, arguments, and error conditions as relu6(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
relu_ | In-place relu: writes the result through self; same formula, arguments, and error conditions as relu(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
remainder | Elementwise remainder with the sign of the DIVISOR, i.e. ops::mod with ModMode::Python. Broadcasts and promotes as add. the broadcast-shaped remainders. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
remainder_ | In-place remainder: writes the remainders through x. ClikaRT::Error as the value form. |
renorm | Caps each sub-tensor's p-norm along dim at maxnorm. |
renorm_ | In-place renorm: rewrites self with each slice's norm capped at maxnorm and returns it under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. ClikaRT::Error as renorm. |
repeat | Tile x by per-dim repeat counts: sizes[i] copies along dim i. |
repeat_interleave | Repeat ELEMENTS, not blocks: each element along dim appears repeats times consecutively ([a, b] with repeats 2 -> [a, a, b, b]). |
replicate_pad | pad in edge-replicate mode: the padding repeats each padded edge's value. Same (lo, hi) pair layout as constant_pad. Copies. |
requantize | |
requantize_ (2 overloads) | |
resample | Audio-domain 1-D rational resample along the LAST axis: [.., S] at orig_freq → [.., ceil(S · L / M)] at new_freq, where L/M is the gcd-reduced rate pair. A kaiser-windowed-sinc polyphase FIR, the standard antialiased sample-rate converter; input outside the signal reads as zero, and equal rates pass the signal through exactly. Leading axes are batch/channels (transpose another samples axis to the back first, a view). The defaults are the kaiser preset: lowpass_filter_width sinc zero-crossings per side, rolloff of the target Nyquist, and (when beta is absent) the design beta 14.769656459379492 (~142.7 dB design stopband). Serves f32 natively and f16/bf16 through an f32 compute lane (output mirrors the input); integer and f64 signals refuse; cast to f32 first. CPU-served; device-resident inputs refuse until an accelerator kernel lands. |
reshape | Reshape to shape; one entry may be -1 to infer it from the element count. A dim entry is an int literal OR a 0-D/1-D integer Tensor (IndexBound); e.g. reshape(x, {shape_host(x, 1), d}) composes without reading sizes to the host. |
reshape_as | Reshape x to other's shape (other supplies extents only; its data is never read). The element counts must match. |
rfft | One-sided real FFT along the last axis: real [..., n] → interleaved (re, im) pairs [..., n_fft/2 + 1, 2]. n_fft defaults to the last axis's extent; normalized scales the spectrum by 1/sqrt(n_fft). |
rms_norm | Root-mean-square normalization over the trailing normalized_shape dims (no mean subtraction). |
roll | Circularly shift elements: shifts[i] positions along dims[i]; elements that fall off one end re-enter at the other. |
rot90 | Rotate the plane spanned by dims by k x 90 degrees (k is taken mod 4; odd rotations swap the two dims' extents). Default plane {0, 1}. Copies. |
rotary_embedding | Rotary position embedding over padded [.., S, D] layouts. |
rotary_embedding_qk | a 2-element array {values, indices}. |
rotary_embedding_qk_varlen | a 2-element array {values, indices}. |
rotary_embedding_varlen | Rotary position embedding over token-packed (variable-length) layouts. |
round | Elementwise rounding to decimals fractional digits. |
round_ | In-place round: writes the result through self; same formula, arguments, and error conditions as round(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
rsqrt | Elementwise reciprocal square root. |
rsqrt_ | In-place rsqrt: writes the result through self; same formula, arguments, and error conditions as rsqrt(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
scaled_dot_product_attention | Scaled dot-product attention over dense head-major tensors. |
scaled_dot_product_attention_varlen | Variable-length (packed) scaled dot-product attention: ragged batches ride one token-packed tensor plus prefix-sum offsets, no padding. |
scatter | A copy of x with src written at positions given by index along dim, the write mirror of gather: out[index[p]][j][k] = src[p] for dim = 0 (only that axis's coordinate is redirected). |
scatter_ | In-place scatter: writes through self at the indexed positions; same arguments and error conditions as scatter(). Writes through self's storage (a strided view reaches its base buffer). Returns self for chaining. |
scatter_add | scatter with ACCUMULATION: out[.., index[p], ..] += src[p]; duplicate destinations sum. |
scatter_add_ | In-place scatter_add: accumulates through self at the indexed positions; same arguments (incl. deterministic) and error conditions as scatter_add(). A strided view reaches its base buffer. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
scatter_reduce | scatter with a REDUCTION at each destination: Sum / Prod / Mean / AMax / AMin (ScatterReduceMode). |
scatter_reduce_ | In-place scatter_reduce: reduces into self at the indexed positions; same arguments and error conditions as scatter_reduce(). A strided view reaches its base buffer. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
searchsorted | Insertion points of values into a sorted sequence. |
select | One position along dim (the dim is removed). index is an int literal OR a 0-D integer Tensor (e.g. a shape_host-derived index) so a data-dependent select never reads the value to the host. |
selu | Scaled exponential linear unit: elu with the fixed SELU constants (alpha ~= 1.6733, scale ~= 1.0507) from the self-normalizing-networks formulation. |
selu_ | In-place selu: writes the result through self; same formula, arguments, and error conditions as selu(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
sgn | Elementwise sign; identical to sign for real dtypes. |
sgn_ | In-place sgn: writes the result through self; same formula, arguments, and error conditions as sgn(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
shape (2 overloads) | The tensor's shape as a 1-D Int64 tensor (or one extent as 0-D). |
shape_host (3 overloads) | The shape of x as a HOST-resident Int64 tensor, written from metadata: no device kernel, no readback, no stream synchronize, whatever device x lives on. The cheap way to feed shape values to shape-consuming arguments (a reshape dim) instead of Tensor::shape()'s concrete ints. |
sigmoid | Logistic sigmoid. |
sigmoid_ | In-place sigmoid: writes the result through self; same formula, arguments, and error conditions as sigmoid(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
sign | Elementwise sign: -1, 0, or 1. |
sign_ | In-place sign: writes the result through self; same formula, arguments, and error conditions as sign(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
silu | Sigmoid linear unit (swish). |
silu_ | In-place silu: writes the result through self; same formula, arguments, and error conditions as silu(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
sin | Elementwise sine. |
sin_ | In-place sin: writes the result through self; same formula, arguments, and error conditions as sin(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
sinc | Elementwise normalized sinc. |
sinc_ | In-place sinc: writes the result through self; same formula, arguments, and error conditions as sinc(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
sinh | Elementwise hyperbolic sine. |
sinh_ | In-place sinh: writes the result through self; same formula, arguments, and error conditions as sinh(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
slice (2 overloads) | [start, end) with step along one dim. Each bound is an int literal, a 0-D integer Tensor, or absent ({}, an open bound); absent step is 1. |
smooth_l1_loss | Smooth-L1 loss: quadratic within beta of zero, L1 beyond it. |
snake | Periodic "snake" activation (neural vocoders), per channels-last channel. |
snake_ | In-place snake: writes the result through self; same formula, arguments, and error conditions as snake(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
softcap_logits | Fused logit soft-cap: cap * tanh(x / cap) (true division), elementwise. A number cap must be > 0 (0 or negative is rejected). A tensor cap broadcasts against x and every element must be non-zero; that precondition is the caller's contract and is not runtime-checked. |
softcap_logits_ | In-place softcap_logits: writes the result through self; same formula, arguments, and error conditions as softcap_logits(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
softmax | Softmax along dim, computed stably (max-subtracted). |
softmax_ | In-place softmax: writes the result through self; same formula, arguments, and error conditions as softmax(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
softmin | Softmax of the negated input: weights small values highest. |
softmin_ | In-place softmin: writes the result through self; same formula, arguments, and error conditions as softmin(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
softplus | Smooth ReLU. |
softplus_ | In-place softplus: writes the result through self; same formula, arguments, and error conditions as softplus(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
softshrink | Soft thresholding: shrinks every element toward zero by lambd. |
softshrink_ | In-place softshrink: writes the result through self; same formula, arguments, and error conditions as softshrink(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
softsign | Softsign activation. |
softsign_ | In-place softsign: writes the result through self; same formula, arguments, and error conditions as softsign(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
sort | a 2-element array {values, indices} of x sorted along dim. |
split_by_size | Split along dim into pieces of chunk_size, ceil(extent / chunk_size) of them, the last possibly shorter. Returns VIEWS sharing the source's storage (no copy). |
split_with_sizes | Split along dim into chunks of the given lengths; sizes must sum to the dim's extent. Each length is a literal or a 0-D integer Tensor. |
sqrt | Elementwise square root. |
sqrt_ | In-place sqrt: writes the result through self; same formula, arguments, and error conditions as sqrt(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
square | Elementwise square. |
square_ | In-place square: writes the result through self; same formula, arguments, and error conditions as square(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
squeeze | Drop size-1 dims: the listed dims (each must be size 1; anything else raises), or EVERY size-1 dim when dim is empty (the default). |
squeeze_ | In-place squeeze: reshapes self's handle in place; same rules and error conditions as squeeze(); the storage is untouched. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
ssd_update | Mamba2 / SSD selective-state serving step over a per-sequence [H, dim, dstate] Float32 state (updated IN PLACE; the returned tensor is out [B, T, H, dim], dtype following x). Per token: the state decays by exp(dt'*A[h]) (dt' = softplus(dt + dt_bias[h]) when dt_softplus), accumulates dt'*(x (outer) B), and emits S*C + D[h]*x (optionally silu-gated by z). A/D/dt_bias are per-head Float32 parameters (A carries the NEGATIVE decay rate; fold -exp(A_log) at bind); B/C are [B, T, G, dstate] with H % G == 0. Decode is T == 1; a prefill runs the same sequential law. seq_lens ([B] Int32) bounds ragged rows. slot_ids ([B] Int32, device-resident) addresses state as a SLAB [num_slots, H, dim, dstate]: batch row b reads/updates slab row slot_ids[b] in place (ids in range and DISTINCT per call, the caller's contract); absent keeps state row b. |
stack | Join tensors along a NEW dim at position dim: all inputs share one shape; output rank = input rank + 1, the new dim sized N. Copies. |
std | Standard deviation of x over dims, with Bessel correction. |
stft | Short-time Fourier transform of a real [L] / [B, L] signal: frames of win_length (default n_fft) at hop_length strides (default n_fft/4), windowed by window when given (a [win_length] tensor; absent = rectangular). Output [T, n_freq, 2] / [B, T, n_freq, 2] with n_freq = n_fft/2 + 1; frames along the time axis first, interleaved (re, im) pairs. center pads n_fft/2 per side in pad_mode before framing; normalized scales by 1/sqrt(n_fft). Only the one-sided form is served; onesided = false refuses. |
sub (2 overloads) | Subtracts other (scaled) from a elementwise. |
sub_ | In-place sub: writes through x. ClikaRT::Error as the value form. |
sum | Sums x over dims. |
swiglu | SwiGLU over a concatenated [*, 2d] gate‖up input → [*, d], the clamped gated form: out = (clamp(up, ±limit) + beta) · G · sigmoid(alpha·G) with G = min(gate, limit). The defaults reduce exactly to the plain silu(gate) · up. The last dim must be even. |
synchronize_all | Block until every live stream in the runtime has finished, a barrier for "wait for all enqueued work to complete" (e.g. before reading a device result on the host, or timing a phase). Infallible: it never raises. |
take | Read elements of self at FLAT (row-major linearized) positions. |
take_along_dim | gather with broadcasting between x and index on the other dims. |
tan | Elementwise tangent. |
tan_ | In-place tan: writes the result through self; same formula, arguments, and error conditions as tan(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
tanh | Elementwise hyperbolic tangent. |
tanh_ | In-place tanh: writes the result through self; same formula, arguments, and error conditions as tanh(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
tensordot | Named-axis contraction: sums a over dims_a against b over dims_b, pairwise. |
threshold | Elementwise threshold: keeps values above threshold, replaces the rest with value. |
threshold_ | In-place threshold: writes the result through self; same formula, arguments, and error conditions as threshold(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
tile | repeat that also accepts FEWER counts than the rank; missing leading entries default to 1. Counts are literals or 0-D integer Tensors (a tensor count traces symbolically). Copies. |
to (3 overloads) | Moves a tensor to a device or stream. |
topk | a 2-element array {values, indices}. |
trace | Sum of the main diagonal of a rank-2 tensor. |
transpose | Swap dim0 and dim1, permute for exactly two dims. Returns a view (no copy). |
tril | Zero out the entries ABOVE the chosen diagonal of the last two axes; the lower-triangular part survives. diagonal: 0 = main, +k above, -k below. Copies. |
tril_ | In-place tril: zeroes the upper triangle through self; same arguments and error conditions as tril(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
triu | Zero out the entries BELOW the chosen diagonal of the last two axes; the upper-triangular part survives. diagonal: 0 = main, +k above, -k below. Copies. |
triu_ | In-place triu: zeroes the lower triangle through self; same arguments and error conditions as triu(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
trunc | Elementwise truncation toward zero (drops the fraction). |
trunc_ | In-place trunc: writes the result through self; same formula, arguments, and error conditions as trunc(). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
unflatten | Split the dim at dim into sizes, the inverse of flatten. The product of sizes must equal that dim's extent. |
unfold | im2col: extracts sliding kernel windows from a channels-last input. |
uniform_ | In-place uniform fill on [low, high): overwrites self at its own shape/dtype and returns it under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
unique | a 3-element array (see the op's semantics for each element). |
unique_consecutive | a 3-element array (see the op's semantics for each element). |
unsqueeze | Insert a size-1 dim at dim. The position is normalized against the OUTPUT rank, so -1 appends at the trailing end. Returns a view (no copy). |
unsqueeze_ | In-place unsqueeze: reshapes self's handle in place; same rules and error conditions as unsqueeze(); the storage is untouched. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
upsample_bicubic2d | 2-D bicubic resize. |
upsample_bilinear2d | 2-D bilinear resize. |
upsample_linear1d | interpolate with InterpMode::Linear (linear / bilinear / trilinear by input rank) or InterpMode::Bicubic. |
upsample_nearest1d | interpolate with InterpMode::Nearest over a 1d/2d/3d input. |
upsample_nearest2d | 2-D nearest-neighbor resize. |
upsample_nearest3d | 3-D nearest-neighbor resize. |
upsample_trilinear3d | 3-D trilinear resize. |
validate_rotary_dim | Checks a rotary-embedding configuration up front: rotary_dim must be positive, even, and (when head_dim is given) no larger than head_dim. |
var | Variance of x over dims, with Bessel correction. |
where (2 overloads) | Elementwise select: condition ? x : y, with numpy-style broadcasting across all three operands. |
xlog1py | Elementwise with the convention (entropy-style sums stay finite where a is zero). Broadcasts and promotes as add. the broadcast-shaped result at the promoted float dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
xlogy | Elementwise with the convention. Broadcasts and promotes as add. the broadcast-shaped result at the promoted float dtype. ClikaRT::Error (INVALID_ARGUMENT) when the operand shapes are not broadcast-compatible. |
xlogy_ | In-place xlogy: writes the result through x. ClikaRT::Error as the value form. |
zero_ | In-place zero fill: overwrites every element of self with zero (the error conditions of zeros()). A view input writes through its base storage. Returns self under the value surface, Result<void> under the Result surface; CLIKART_CHECK is the mode-stable spelling. |
zeros | A new tensor of the given shape with every element set to zero. |
zeros_like | A zero-filled tensor with reference's shape and dtype (data never read); s absent = the reference's own device. |
ClikaRT/compute/op_enums.h
#include <ClikaRT/compute/op_enums.h>
Enum parameters carried by the fused ops: the activation epilogue a matmul/linear/embedding/norm applies in one pass, and the rotary-embedding mode / scaling family. Mirror the internal enums by name and order (ABI: never reorder or remove a value; append new ones at the end).
ClikaRT/compute/ops.h
#include <ClikaRT/compute/ops.h>
Core tensor operations as free functions over Tensor. Each returns its result BY VALUE and raises ClikaRT::Error on failure (the inline wrapper throws in your own TU; the impl:: forms return a Result). Tensors pass BY VALUE, a cheap refcounted handle the runtime may donate; std::move one in when you're done with it. Composes directly: ops::relu(ops::matmul(a, b)).
ClikaRT/compute/tensor.h
#include <ClikaRT/compute/tensor.h>
The central value type: an N-dimensional array on a device, with a shape, a data type, and a placement. Build one from host data or a factory, move it between devices and dtypes with to, and read its bytes back. The op / module / runtime layers all traffic in Tensor.
Macros
#define ICLIKART_TENSOR_ACT
#define ICLIKART_TENSOR_ACT(NAME) CLIKART_RESULT(Tensor) NAME() const { CLIKART_UNWRAP(NAME##_impl()); } \ CLIKART_INPLACE_RESULT(Tensor) NAME##_() { CLIKART_INPLACE_UNWRAP(NAME##_inplace_impl(), *this); }
Declared in ClikaRT/compute/tensor.h, line 595
#define ICLIKART_TENSOR_ACT_IMPL
#define ICLIKART_TENSOR_ACT_IMPL(NAME) Result<Tensor> NAME##_impl() const; \ Result<void> NAME##_inplace_impl();
Declared in ClikaRT/compute/tensor.h, line 734