XU XUv0.16.0

#tensor

import: #tensor

counts: 97 functions, 51 methods, 18 types, 13 constants, 0 method sets

Standard library package `#tensor`.

struct DType

XuAPI
pub struct DType {

}

Purpose

Dense scalar encodings with little-endian storage.

Public fields

This type has no public fields.

dtype_f32

XuAPI
pub fn dtype_f32() DType

Purpose

Dtype f32.

Parameters

No arguments are required.

Returns

DType — a value of this type

dtype_f16

XuAPI
pub fn dtype_f16() DType

Purpose

Dtype f16.

Parameters

No arguments are required.

Returns

DType — a value of this type

dtype_bf16

XuAPI
pub fn dtype_bf16() DType

Purpose

Dtype bf16.

Parameters

No arguments are required.

Returns

DType — a value of this type

dtype_fp8_e4m3fn

XuAPI
pub fn dtype_fp8_e4m3fn() DType

Purpose

Dtype fp8 e4m3fn.

Parameters

No arguments are required.

Returns

DType — a value of this type

dtype_fp8_e5m2

XuAPI
pub fn dtype_fp8_e5m2() DType

Purpose

Dtype fp8 e5m2.

Parameters

No arguments are required.

Returns

DType — a value of this type

dtype_fp8_e4m3fnuz

XuAPI
pub fn dtype_fp8_e4m3fnuz() DType

Purpose

Dtype fp8 e4m3fnuz.

Parameters

No arguments are required.

Returns

DType — a value of this type

dtype_fp8_e5m2fnuz

XuAPI
pub fn dtype_fp8_e5m2fnuz() DType

Purpose

Dtype fp8 e5m2fnuz.

Parameters

No arguments are required.

Returns

DType — a value of this type

(DType) is_f32

XuAPI
pub fn (dtype DType) is_f32() bool

Purpose

Operation on DType: whether it is f32.

Parameters

dtype DType
The DType instance used by this call (value receiver).

Returns

bool — true or false

(DType) element_bytes

XuAPI
pub fn (dtype DType) element_bytes() int

Purpose

Operation on DType: element bytes.

Parameters

dtype DType
The DType instance used by this call (value receiver).

Returns

int — a value of this type

(DType) decode_bits

XuAPI
pub fn (dtype DType) decode_bits(raw int) f32

Purpose

Decode scalar bits to f32. Unused upper bits are ignored.

Parameters

dtype DType
The DType instance used by this call (value receiver).
raw int
raw (int)

Returns

f32 — a value of this type

(DType) encode_bits

XuAPI
pub fn (dtype DType) encode_bits(value f32) int

Purpose

Encode a compute value to the scalar's storage bits.

Parameters

dtype DType
The DType instance used by this call (value receiver).
value f32
value (f32)

Returns

int — a value of this type

safetensors_dtype

XuAPI
pub fn safetensors_dtype(name &string) DType

Purpose

Safetensors dtype. Throws on failure; handle the error or propagate it to the caller.

Parameters

name &string
name (read-only borrow; caller keeps the original; type &string)

Returns

DType — a value of this type

dtype_named

XuAPI
pub fn dtype_named(name &string) DType

Purpose

Parse the short names used to select an in-memory tensor encoding. Throws on failure; handle the error or propagate it to the caller.

Parameters

name &string
name (read-only borrow; caller keeps the original; type &string)

Returns

DType — a value of this type

struct F16

XuAPI
pub struct F16 {
    pub bits u16
}

Purpose

Fixed-width storage scalars. Raw bits are exposed for lossless serialization.

Public fields

bits u16
bit count

struct BF16

XuAPI
pub struct BF16 {
    pub bits u16
}

Purpose

Structure encapsulating bits.

Public fields

bits u16
bit count

struct Fp8E4M3Fn

XuAPI
pub struct Fp8E4M3Fn {
    pub bits u8
}

Purpose

Structure encapsulating bits.

Public fields

bits u8
bit count

struct Fp8E5M2

XuAPI
pub struct Fp8E5M2 {
    pub bits u8
}

Purpose

Structure encapsulating bits.

Public fields

bits u8
bit count

struct Fp8E4M3Fnuz

XuAPI
pub struct Fp8E4M3Fnuz {
    pub bits u8
}

Purpose

Structure encapsulating bits.

Public fields

bits u8
bit count

struct Fp8E5M2Fnuz

XuAPI
pub struct Fp8E5M2Fnuz {
    pub bits u8
}

Purpose

Structure encapsulating bits.

Public fields

bits u8
bit count

f16

XuAPI
pub fn f16(value f32) F16

Purpose

Convert to IEEE binary16, rounding to nearest with ties to even.

Parameters

value f32
value (f32)

Returns

F16 — a value of this type

(&F16) to_f32

XuAPI
pub fn (x &F16) to_f32() f32

Purpose

Operation on &F16: convert to f32.

Parameters

x &F16
The F16 instance used by this call (borrow).

Returns

f32 — a value of this type

bf16

XuAPI
pub fn bf16(value f32) BF16

Purpose

Convert to bfloat16, rounding to nearest with ties to even and quieting NaNs.

Parameters

value f32
value (f32)

Returns

BF16 — a value of this type

(&BF16) to_f32

XuAPI
pub fn (x &BF16) to_f32() f32

Purpose

Operation on &BF16: convert to f32.

Parameters

x &BF16
The BF16 instance used by this call (borrow).

Returns

f32 — a value of this type

fp8_e4m3fn

XuAPI
pub fn fp8_e4m3fn(value f32) Fp8E4M3Fn

Purpose

FP8 constructors saturate finite overflow and round ties to even. Formats with infinity preserve it. FNUZ formats use an unsigned zero.

Parameters

value f32
value (f32)

Returns

Fp8E4M3Fn — a value of this type

fp8_e5m2

XuAPI
pub fn fp8_e5m2(value f32) Fp8E5M2

Purpose

Fp8 e5m2.

Parameters

value f32
value (f32)

Returns

Fp8E5M2 — a value of this type

fp8_e4m3fnuz

XuAPI
pub fn fp8_e4m3fnuz(value f32) Fp8E4M3Fnuz

Purpose

Fp8 e4m3fnuz.

Parameters

value f32
value (f32)

Returns

Fp8E4M3Fnuz — a value of this type

fp8_e5m2fnuz

XuAPI
pub fn fp8_e5m2fnuz(value f32) Fp8E5M2Fnuz

Purpose

Fp8 e5m2fnuz.

Parameters

value f32
value (f32)

Returns

Fp8E5M2Fnuz — a value of this type

(&Fp8E4M3Fn) to_f32

XuAPI
pub fn (x &Fp8E4M3Fn) to_f32() f32

Purpose

Operation on &Fp8E4M3Fn: convert to f32.

Parameters

x &Fp8E4M3Fn
The Fp8E4M3Fn instance used by this call (borrow).

Returns

f32 — a value of this type

(&Fp8E5M2) to_f32

XuAPI
pub fn (x &Fp8E5M2) to_f32() f32

Purpose

Operation on &Fp8E5M2: convert to f32.

Parameters

x &Fp8E5M2
The Fp8E5M2 instance used by this call (borrow).

Returns

f32 — a value of this type

(&Fp8E4M3Fnuz) to_f32

XuAPI
pub fn (x &Fp8E4M3Fnuz) to_f32() f32

Purpose

Operation on &Fp8E4M3Fnuz: convert to f32.

Parameters

x &Fp8E4M3Fnuz
The Fp8E4M3Fnuz instance used by this call (borrow).

Returns

f32 — a value of this type

(&Fp8E5M2Fnuz) to_f32

XuAPI
pub fn (x &Fp8E5M2Fnuz) to_f32() f32

Purpose

Operation on &Fp8E5M2Fnuz: convert to f32.

Parameters

x &Fp8E5M2Fnuz
The Fp8E5M2Fnuz instance used by this call (borrow).

Returns

f32 — a value of this type

dot_f32

XuAPI
pub fn dot_f32(a &[]f32, b &[]f32, n int) f32

Purpose

Dot f32.

Parameters

a &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
b &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

f32 — a value of this type

axpy_f32

XuAPI
pub fn axpy_f32(dst $&[]f32, src &[]f32, alpha f32, n int)

Purpose

Axpy f32.

Parameters

dst $&[]f32
destination (exclusive borrow; may modify the original; type $&[]f32)
src &[]f32
source (read-only borrow; caller keeps the original; type &[]f32)
alpha f32
alpha (f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

vadd_f32

XuAPI
pub fn vadd_f32(dst $&[]f32, src &[]f32, n int)

Purpose

Vadd f32.

Parameters

dst $&[]f32
destination (exclusive borrow; may modify the original; type $&[]f32)
src &[]f32
source (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

vmul_f32

XuAPI
pub fn vmul_f32(out $&[]f32, a &[]f32, b &[]f32, n int)

Purpose

Vmul f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
a &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
b &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

vscale_f32

XuAPI
pub fn vscale_f32(dst $&[]f32, scale f32, n int)

Purpose

Vscale f32.

Parameters

dst $&[]f32
destination (exclusive borrow; may modify the original; type $&[]f32)
scale f32
scale (f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

rmsnorm_f32

XuAPI
pub fn rmsnorm_f32(out $&[]f32, x &[]f32, weight &[]f32, n int, eps f64)

Purpose

Rmsnorm f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
weight &[]f32
weight (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)
eps f64
eps (f64)

Returns

This call does not return a value.

softmax_f32

XuAPI
pub fn softmax_f32(scores $&[]f32, n int, scale f32)

Purpose

Softmax f32.

Parameters

scores $&[]f32
scores (exclusive borrow; may modify the original; type $&[]f32)
n int
count, length, or limit (int)
scale f32
scale (f32)

Returns

This call does not return a value.

swiglu_f32

XuAPI
pub fn swiglu_f32(out $&[]f32, gate &[]f32, up &[]f32, n int)

Purpose

Swiglu f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
gate &[]f32
gate (read-only borrow; caller keeps the original; type &[]f32)
up &[]f32
up (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

matvec_f32

XuAPI
pub fn matvec_f32(out $&[]f32, x &[]f32, weights &[]f32, rows int, cols int)

Purpose

Matvec f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
weights &[]f32
weights (read-only borrow; caller keeps the original; type &[]f32)
rows int
rows (int)
cols int
cols (int)

Returns

This call does not return a value.

matmul_f32

XuAPI
pub fn matmul_f32(out $&[]f32, x &[]f32, weights &[]f32, m_cnt int, rows int, cols int)

Purpose

Matmul f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
weights &[]f32
weights (read-only borrow; caller keeps the original; type &[]f32)
m_cnt int
m_cnt (int)
rows int
rows (int)
cols int
cols (int)

Returns

This call does not return a value.

argmax_f32

XuAPI
pub fn argmax_f32(x &[]f32, n int) int

Purpose

Argmax f32.

Parameters

x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

int — a value of this type

quantize_q8_0

XuAPI
pub fn quantize_q8_0(x &[]f32, xq $&[]i8, scales $&[]f32, n int)

Purpose

Quantize q8 0.

Parameters

x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
xq $&[]i8
xq (exclusive borrow; may modify the original; type $&[]i8)
scales $&[]f32
scales (exclusive borrow; may modify the original; type $&[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

vsub_f32

XuAPI
pub fn vsub_f32(out $&[]f32, a &[]f32, b &[]f32, n int)

Purpose

Vsub f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
a &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
b &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

silu_f32

XuAPI
pub fn silu_f32(out $&[]f32, x &[]f32, n int)

Purpose

Silu f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

gelu_f32

XuAPI
pub fn gelu_f32(out $&[]f32, x &[]f32, n int)

Purpose

Gelu f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

layernorm_f32

XuAPI
pub fn layernorm_f32(out $&[]f32, x &[]f32, weight &[]f32, bias &[]f32, n int, eps f64)

Purpose

Layernorm f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
weight &[]f32
weight (read-only borrow; caller keeps the original; type &[]f32)
bias &[]f32
bias (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)
eps f64
eps (f64)

Returns

This call does not return a value.

l2_normalize_f32

XuAPI
pub fn l2_normalize_f32(out $&[]f32, x &[]f32, n int, eps f64)

Purpose

L2 normalize f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)
eps f64
eps (f64)

Returns

This call does not return a value.

cosine_similarity_f32

XuAPI
pub fn cosine_similarity_f32(a &[]f32, b &[]f32, n int) f32

Purpose

Cosine similarity f32.

Parameters

a &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
b &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

f32 — a value of this type

rope_f32

XuAPI
pub fn rope_f32(vec $&[]f32, n_heads int, head_dim int, pos int, theta f64)

Purpose

Rope f32.

Parameters

vec $&[]f32
vec (exclusive borrow; may modify the original; type $&[]f32)
n_heads int
n_heads (int)
head_dim int
head_dim (int)
pos int
pos (int)
theta f64
theta (f64)

Returns

This call does not return a value.

quantize_q4_0_row

XuAPI
pub fn quantize_q4_0_row(x &[]f32, qs $&[]u8, scales $&[]f32, n int)

Purpose

Quantize q4 0 row.

Parameters

x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
qs $&[]u8
qs (exclusive borrow; may modify the original; type $&[]u8)
scales $&[]f32
scales (exclusive borrow; may modify the original; type $&[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

rope_interleaved_f32

XuAPI
pub fn rope_interleaved_f32(vec $&[]f32, n_heads int, head_dim int, pos int, theta f64)

Purpose

Rope interleaved f32.

Parameters

vec $&[]f32
vec (exclusive borrow; may modify the original; type $&[]f32)
n_heads int
n_heads (int)
head_dim int
head_dim (int)
pos int
pos (int)
theta f64
theta (f64)

Returns

This call does not return a value.

geglu_f32

XuAPI
pub fn geglu_f32(out $&[]f32, gate &[]f32, up &[]f32, n int)

Purpose

Geglu f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
gate &[]f32
gate (read-only borrow; caller keeps the original; type &[]f32)
up &[]f32
up (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

log_softmax_f32

XuAPI
pub fn log_softmax_f32(scores $&[]f32, n int)

Purpose

Log softmax f32.

Parameters

scores $&[]f32
scores (exclusive borrow; may modify the original; type $&[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

add_rmsnorm_f32

XuAPI
pub fn add_rmsnorm_f32(norm_out $&[]f32, residual_out $&[]f32, x &[]f32, residual &[]f32, weight &[]f32, n int, eps f64)

Purpose

Add rmsnorm f32.

Parameters

norm_out $&[]f32
norm_out (exclusive borrow; may modify the original; type $&[]f32)
residual_out $&[]f32
residual_out (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
residual &[]f32
residual (read-only borrow; caller keeps the original; type &[]f32)
weight &[]f32
weight (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)
eps f64
eps (f64)

Returns

This call does not return a value.

topk_f32

XuAPI
pub fn topk_f32(x &[]f32, n int, k int, out_idx $&[]int, out_val $&[]f32) int

Purpose

Topk f32.

Parameters

x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)
k int
key or index (int)
out_idx $&[]int
out_idx (exclusive borrow; may modify the original; type $&[]int)
out_val $&[]f32
out_val (exclusive borrow; may modify the original; type $&[]f32)

Returns

int — a value of this type

moe_router_f32

XuAPI
pub fn moe_router_f32(logits &[]f32, n_experts int, top_k int, use_sigmoid bool, norm_topk bool, scale f64, bias &[]f32, out_idx $&[]int, out_w $&[]f32) int

Purpose

Moe router f32.

Parameters

logits &[]f32
logits (read-only borrow; caller keeps the original; type &[]f32)
n_experts int
n_experts (int)
top_k int
top_k (int)
use_sigmoid bool
use_sigmoid (bool)
norm_topk bool
norm_topk (bool)
scale f64
scale (f64)
bias &[]f32
bias (read-only borrow; caller keeps the original; type &[]f32)
out_idx $&[]int
out_idx (exclusive borrow; may modify the original; type $&[]int)
out_w $&[]f32
out_w (exclusive borrow; may modify the original; type $&[]f32)

Returns

int — a value of this type

rope_yarn_f32

XuAPI
pub fn rope_yarn_f32(vec $&[]f32, n_heads int, head_dim int, rope_dim int, interleaved bool, pos int, theta f64, scale f64, orig_ctx int, beta_fast f64, beta_slow f64, attn_factor f64)

Purpose

Rope yarn f32.

Parameters

vec $&[]f32
vec (exclusive borrow; may modify the original; type $&[]f32)
n_heads int
n_heads (int)
head_dim int
head_dim (int)
rope_dim int
rope_dim (int)
interleaved bool
interleaved (bool)
pos int
pos (int)
theta f64
theta (f64)
scale f64
scale (f64)
orig_ctx int
orig_ctx (int)
beta_fast f64
beta_fast (f64)
beta_slow f64
beta_slow (f64)
attn_factor f64
attn_factor (f64)

Returns

This call does not return a value.

topk_cosine_f32

XuAPI
pub fn topk_cosine_f32(query &[]f32, corpus &[]f32, n_docs int, dim int, k int, out_idx $&[]int, out_score $&[]f32) int

Purpose

Topk cosine f32.

Parameters

query &[]f32
query (read-only borrow; caller keeps the original; type &[]f32)
corpus &[]f32
corpus (read-only borrow; caller keeps the original; type &[]f32)
n_docs int
n_docs (int)
dim int
dim (int)
k int
key or index (int)
out_idx $&[]int
out_idx (exclusive borrow; may modify the original; type $&[]int)
out_score $&[]f32
out_score (exclusive borrow; may modify the original; type $&[]f32)

Returns

int — a value of this type

cross_entropy_grad_f32

XuAPI
pub fn cross_entropy_grad_f32(dlogits $&[]f32, logits &[]f32, target int, n int) f32

Purpose

Cross entropy grad f32.

Parameters

dlogits $&[]f32
dlogits (exclusive borrow; may modify the original; type $&[]f32)
logits &[]f32
logits (read-only borrow; caller keeps the original; type &[]f32)
target int
target (int)
n int
count, length, or limit (int)

Returns

f32 — a value of this type

adamw_step_f32

XuAPI
pub fn adamw_step_f32(param $&[]f32, grad &[]f32, m $&[]f32, v $&[]f32, n int, lr f32, beta1 f32, beta2 f32, eps f32, weight_decay f32, step int)

Purpose

Adamw step f32.

Parameters

param $&[]f32
param (exclusive borrow; may modify the original; type $&[]f32)
grad &[]f32
grad (read-only borrow; caller keeps the original; type &[]f32)
m $&[]f32
m (exclusive borrow; may modify the original; type $&[]f32)
v $&[]f32
value (exclusive borrow; may modify the original; type $&[]f32)
n int
count, length, or limit (int)
lr f32
lr (f32)
beta1 f32
beta1 (f32)
beta2 f32
beta2 (f32)
eps f32
eps (f32)
weight_decay f32
weight_decay (f32)
step int
step (int)

Returns

This call does not return a value.

lora_add_f32

XuAPI
pub fn lora_add_f32(out $&[]f32, x &[]f32, a &[]f32, b &[]f32, rows int, cols int, rank int, scale f32)

Purpose

Lora add f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
a &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
b &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
rows int
rows (int)
cols int
cols (int)
rank int
rank (int)
scale f32
scale (f32)

Returns

This call does not return a value.

lora_backward_f32

XuAPI
pub fn lora_backward_f32(dx $&[]f32, da $&[]f32, db $&[]f32, dy &[]f32, x &[]f32, a &[]f32, b &[]f32, out_dim int, in_dim int, rank int, scale f64)

Purpose

Lora backward f32.

Parameters

dx $&[]f32
dx (exclusive borrow; may modify the original; type $&[]f32)
da $&[]f32
da (exclusive borrow; may modify the original; type $&[]f32)
db $&[]f32
db (exclusive borrow; may modify the original; type $&[]f32)
dy &[]f32
dy (read-only borrow; caller keeps the original; type &[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
a &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
b &[]f32
slice to operate on (read-only borrow; caller keeps the original; type &[]f32)
out_dim int
out_dim (int)
in_dim int
in_dim (int)
rank int
rank (int)
scale f64
scale (f64)

Returns

This call does not return a value.

rmsnorm_backward_f32

XuAPI
pub fn rmsnorm_backward_f32(dx $&[]f32, dw $&[]f32, dy &[]f32, x &[]f32, w &[]f32, n int, eps f64)

Purpose

Rmsnorm backward f32.

Parameters

dx $&[]f32
dx (exclusive borrow; may modify the original; type $&[]f32)
dw $&[]f32
dw (exclusive borrow; may modify the original; type $&[]f32)
dy &[]f32
dy (read-only borrow; caller keeps the original; type &[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
w &[]f32
writer or width (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)
eps f64
eps (f64)

Returns

This call does not return a value.

swiglu_backward_f32

XuAPI
pub fn swiglu_backward_f32(dgate $&[]f32, dup $&[]f32, dy &[]f32, gate &[]f32, up &[]f32, n int)

Purpose

Swiglu backward f32.

Parameters

dgate $&[]f32
dgate (exclusive borrow; may modify the original; type $&[]f32)
dup $&[]f32
dup (exclusive borrow; may modify the original; type $&[]f32)
dy &[]f32
dy (read-only borrow; caller keeps the original; type &[]f32)
gate &[]f32
gate (read-only borrow; caller keeps the original; type &[]f32)
up &[]f32
up (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

layernorm_backward_f32

XuAPI
pub fn layernorm_backward_f32(dx $&[]f32, dw $&[]f32, db $&[]f32, dy &[]f32, x &[]f32, weight &[]f32, n int, eps f64)

Purpose

Layernorm backward f32.

Parameters

dx $&[]f32
dx (exclusive borrow; may modify the original; type $&[]f32)
dw $&[]f32
dw (exclusive borrow; may modify the original; type $&[]f32)
db $&[]f32
db (exclusive borrow; may modify the original; type $&[]f32)
dy &[]f32
dy (read-only borrow; caller keeps the original; type &[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
weight &[]f32
weight (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)
eps f64
eps (f64)

Returns

This call does not return a value.

softmax_backward_f32

XuAPI
pub fn softmax_backward_f32(dx $&[]f32, dy &[]f32, probs &[]f32, n int)

Purpose

Softmax backward f32.

Parameters

dx $&[]f32
dx (exclusive borrow; may modify the original; type $&[]f32)
dy &[]f32
dy (read-only borrow; caller keeps the original; type &[]f32)
probs &[]f32
probs (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)

Returns

This call does not return a value.

grad_clip_norm_f32

XuAPI
pub fn grad_clip_norm_f32(grad $&[]f32, n int, max_norm f32) f32

Purpose

Grad clip norm f32.

Parameters

grad $&[]f32
grad (exclusive borrow; may modify the original; type $&[]f32)
n int
count, length, or limit (int)
max_norm f32
max_norm (f32)

Returns

f32 — a value of this type

kl_div_grad_f32

XuAPI
pub fn kl_div_grad_f32(grad_student $&[]f32, student_logits &[]f32, teacher_logits &[]f32, n int, temperature f32) f32

Purpose

Kl div grad f32.

Parameters

grad_student $&[]f32
grad_student (exclusive borrow; may modify the original; type $&[]f32)
student_logits &[]f32
student_logits (read-only borrow; caller keeps the original; type &[]f32)
teacher_logits &[]f32
teacher_logits (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)
temperature f32
temperature (f32)

Returns

f32 — a value of this type

dpo_loss_grad_f32

XuAPI
pub fn dpo_loss_grad_f32(pi_chosen_logp f32, pi_rejected_logp f32, ref_chosen_logp f32, ref_rejected_logp f32, beta f32, out_grad $&[]f32) f32

Purpose

Dpo loss grad f32.

Parameters

pi_chosen_logp f32
pi_chosen_logp (f32)
pi_rejected_logp f32
pi_rejected_logp (f32)
ref_chosen_logp f32
ref_chosen_logp (f32)
ref_rejected_logp f32
ref_rejected_logp (f32)
beta f32
beta (f32)
out_grad $&[]f32
out_grad (exclusive borrow; may modify the original; type $&[]f32)

Returns

f32 — a value of this type

grpo_advantages_f32

XuAPI
pub fn grpo_advantages_f32(out_adv $&[]f32, rewards &[]f32, n int, eps f32)

Purpose

Grpo advantages f32.

Parameters

out_adv $&[]f32
out_adv (exclusive borrow; may modify the original; type $&[]f32)
rewards &[]f32
rewards (read-only borrow; caller keeps the original; type &[]f32)
n int
count, length, or limit (int)
eps f32
eps (f32)

Returns

This call does not return a value.

conv1d_causal_step_f32

XuAPI
pub fn conv1d_causal_step_f32(out $&[]f32, state $&[]f32, x &[]f32, weight &[]f32, bias &[]f32, d_inner int, k_size int)

Purpose

Conv1d causal step f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
state $&[]f32
state (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
weight &[]f32
weight (read-only borrow; caller keeps the original; type &[]f32)
bias &[]f32
bias (read-only borrow; caller keeps the original; type &[]f32)
d_inner int
d_inner (int)
k_size int
k_size (int)

Returns

This call does not return a value.

ssm_scan_step_f32

XuAPI
pub fn ssm_scan_step_f32(out $&[]f32, state $&[]f32, x &[]f32, dt &[]f32, a_log &[]f32, b_vec &[]f32, c_vec &[]f32, d_skip &[]f32, d_inner int, d_state int)

Purpose

Ssm scan step f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
state $&[]f32
state (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
dt &[]f32
dt (read-only borrow; caller keeps the original; type &[]f32)
a_log &[]f32
a_log (read-only borrow; caller keeps the original; type &[]f32)
b_vec &[]f32
b_vec (read-only borrow; caller keeps the original; type &[]f32)
c_vec &[]f32
c_vec (read-only borrow; caller keeps the original; type &[]f32)
d_skip &[]f32
d_skip (read-only borrow; caller keeps the original; type &[]f32)
d_inner int
d_inner (int)
d_state int
d_state (int)

Returns

This call does not return a value.

linear_attn_step_f32

XuAPI
pub fn linear_attn_step_f32(out $&[]f32, state $&[]f32, z_state $&[]f32, q &[]f32, k &[]f32, v &[]f32, decay f32, n_heads int, head_dim int, eps f32)

Purpose

Linear attn step f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
state $&[]f32
state (exclusive borrow; may modify the original; type $&[]f32)
z_state $&[]f32
z_state (exclusive borrow; may modify the original; type $&[]f32)
q &[]f32
q (read-only borrow; caller keeps the original; type &[]f32)
k &[]f32
key or index (read-only borrow; caller keeps the original; type &[]f32)
v &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
decay f32
decay (f32)
n_heads int
n_heads (int)
head_dim int
head_dim (int)
eps f32
eps (f32)

Returns

This call does not return a value.

ppo_clip_grad_f32

XuAPI
pub fn ppo_clip_grad_f32(new_logp f32, old_logp f32, ref_logp f32, advantage f32, clip_eps f32, kl_beta f32, out_grad $&[]f32) f32

Purpose

Ppo clip grad f32.

Parameters

new_logp f32
new_logp (f32)
old_logp f32
old_logp (f32)
ref_logp f32
ref_logp (f32)
advantage f32
advantage (f32)
clip_eps f32
clip_eps (f32)
kl_beta f32
kl_beta (f32)
out_grad $&[]f32
out_grad (exclusive borrow; may modify the original; type $&[]f32)

Returns

f32 — a value of this type

conv2d_patch_embed_f32

XuAPI
pub fn conv2d_patch_embed_f32(out $&[]f32, img &[]f32, weight &[]f32, bias &[]f32, in_c int, img_h int, img_w int, out_c int, patch int)

Purpose

Conv2d patch embed f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
img &[]f32
img (read-only borrow; caller keeps the original; type &[]f32)
weight &[]f32
weight (read-only borrow; caller keeps the original; type &[]f32)
bias &[]f32
bias (read-only borrow; caller keeps the original; type &[]f32)
in_c int
in_c (int)
img_h int
img_h (int)
img_w int
img_w (int)
out_c int
out_c (int)
patch int
patch (int)

Returns

This call does not return a value.

mha_sdpa_f32

XuAPI
pub fn mha_sdpa_f32(out $&[]f32, q &[]f32, k &[]f32, v &[]f32, seq_q int, seq_k int, n_heads int, head_dim int, causal bool)

Purpose

Mha sdpa f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
q &[]f32
q (read-only borrow; caller keeps the original; type &[]f32)
k &[]f32
key or index (read-only borrow; caller keeps the original; type &[]f32)
v &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
seq_q int
seq_q (int)
seq_k int
seq_k (int)
n_heads int
n_heads (int)
head_dim int
head_dim (int)
causal bool
causal (bool)

Returns

This call does not return a value.

avg_pool2d_f32

XuAPI
pub fn avg_pool2d_f32(out $&[]f32, x &[]f32, channels int, h int, w int, kernel int, stride int)

Purpose

Avg pool2d f32.

Parameters

out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
channels int
channels (int)
h int
height or handle (int)
w int
writer or width (int)
kernel int
kernel (int)
stride int
stride (int)

Returns

This call does not return a value.

const GGML_BLOCK_VALUES

XuAPI
pub const GGML_BLOCK_VALUES = 32

Purpose

Constant GGML_BLOCK_VALUES, defining protocol or algorithm parameters.

const Q4_0_BYTES

XuAPI
pub const Q4_0_BYTES = 18

Purpose

Constant Q4_0_BYTES, defining protocol or algorithm parameters.

const Q4_1_BYTES

XuAPI
pub const Q4_1_BYTES = 20

Purpose

Constant Q4_1_BYTES, defining protocol or algorithm parameters.

const Q5_0_BYTES

XuAPI
pub const Q5_0_BYTES = 22

Purpose

Constant Q5_0_BYTES, defining protocol or algorithm parameters.

const Q5_1_BYTES

XuAPI
pub const Q5_1_BYTES = 24

Purpose

Constant Q5_1_BYTES, defining protocol or algorithm parameters.

const Q8_0_BYTES

XuAPI
pub const Q8_0_BYTES = 34

Purpose

Constant Q8_0_BYTES, defining protocol or algorithm parameters.

const QK_K

XuAPI
pub const QK_K = 256

Purpose

Constant QK_K, defining protocol or algorithm parameters.

const Q2_K_BYTES

XuAPI
pub const Q2_K_BYTES = 84

Purpose

Constant Q2_K_BYTES, defining protocol or algorithm parameters.

const Q3_K_BYTES

XuAPI
pub const Q3_K_BYTES = 110

Purpose

Constant Q3_K_BYTES, defining protocol or algorithm parameters.

const Q4_K_BYTES

XuAPI
pub const Q4_K_BYTES = 144

Purpose

Constant Q4_K_BYTES, defining protocol or algorithm parameters.

const Q5_K_BYTES

XuAPI
pub const Q5_K_BYTES = 176

Purpose

Constant Q5_K_BYTES, defining protocol or algorithm parameters.

const Q6_K_BYTES

XuAPI
pub const Q6_K_BYTES = 210

Purpose

Constant Q6_K_BYTES, defining protocol or algorithm parameters.

const Q8_K_BYTES

XuAPI
pub const Q8_K_BYTES = 292

Purpose

Constant Q8_K_BYTES, defining protocol or algorithm parameters.

struct Q4Block

XuAPI
pub struct Q4Block {
    pub scale F16
    pub packed [16]u8
}

Purpose

GGML Q4_0 stores a little-endian binary16 scale and 16 packed bytes. Each byte contains a low nibble for index i and a high nibble for i+16.

Public fields

scale F16
field (F16)
packed [16]u8
field ([16]u8)

struct Q41Block

XuAPI
pub struct Q41Block {
    pub d F16
    pub m F16
    pub qs [16]u8
}

Purpose

GGML Q4_1 stores little-endian f16 d, f16 m, and 16 nibble bytes (x = q*d + m).

Public fields

d F16
field (F16)
m F16
field (F16)
qs [16]u8
field ([16]u8)

struct Q51Block

XuAPI
pub struct Q51Block {
    pub d F16
    pub m F16
    pub qh [4]u8
    pub qs [16]u8
}

Purpose

GGML Q5_1 stores little-endian f16 d, f16 m, 4 bytes high bits, and 16 nibble bytes.

Public fields

d F16
field (F16)
m F16
field (F16)
qh [4]u8
field ([4]u8)
qs [16]u8
field ([16]u8)

struct Q2KBlock

XuAPI
pub struct Q2KBlock {
    pub scales [16]u8
    pub qs [64]u8
    pub d F16
    pub dmin F16
}

Purpose

GGML Q2_K super-block encodes 256 values in 84 bytes: 16 scale/min bytes, 64 bytes of 2-bit quants, trailing f16 d and f16 dmin.

Public fields

scales [16]u8
field ([16]u8)
qs [64]u8
field ([64]u8)
d F16
field (F16)
dmin F16
field (F16)

struct Q3KBlock

XuAPI
pub struct Q3KBlock {
    pub hmask [32]u8
    pub qs [64]u8
    pub scales [12]u8
    pub d F16
}

Purpose

GGML Q3_K super-block encodes 256 values in 110 bytes: 32 hmask bytes, 64 bytes of 2-bit low quants, 12 packed 6-bit scales, and trailing f16 d.

Public fields

hmask [32]u8
field ([32]u8)
qs [64]u8
field ([64]u8)
scales [12]u8
field ([12]u8)
d F16
field (F16)

struct Q5Block

XuAPI
pub struct Q5Block {
    pub scale F16
    pub qh [4]u8
    pub qs [16]u8
}

Purpose

GGML Q5_0 stores a little-endian binary16 scale, 4 bytes of 5th high bits, and 16 bytes of packed low nibbles.

Public fields

scale F16
field (F16)
qh [4]u8
field ([4]u8)
qs [16]u8
field ([16]u8)

struct Q8Block

XuAPI
pub struct Q8Block {
    pub scale F16
    pub quants [32]i8
}

Purpose

GGML Q8_0 stores the same scale followed by 32 signed quantized bytes.

Public fields

scale F16
field (F16)
quants [32]i8
field ([32]i8)

struct Q4KBlock

XuAPI
pub struct Q4KBlock {
    pub d F16
    pub dmin F16
    pub scales [12]u8
    pub qs [128]u8
}

Purpose

GGML Q4_K super-block encodes 256 values in 144 bytes: f16 d/dmin, 12 packed 6-bit scale/min bytes, and 128 bytes of 4-bit unsigned nibbles.

Public fields

d F16
field (F16)
dmin F16
field (F16)
scales [12]u8
field ([12]u8)
qs [128]u8
field ([128]u8)

struct Q5KBlock

XuAPI
pub struct Q5KBlock {
    pub d F16
    pub dmin F16
    pub scales [12]u8
    pub qh [32]u8
    pub qs [128]u8
}

Purpose

GGML Q5_K super-block encodes 256 values in 176 bytes: f16 d/dmin, 12 packed 6-bit scale/min bytes, 32 high-bit bytes qh, and 128 low-nibble bytes qs.

Public fields

d F16
field (F16)
dmin F16
field (F16)
scales [12]u8
field ([12]u8)
qh [32]u8
field ([32]u8)
qs [128]u8
field ([128]u8)

struct Q6KBlock

XuAPI
pub struct Q6KBlock {
    pub ql [128]u8
    pub qh [64]u8
    pub scales [16]i8
    pub d F16
}

Purpose

GGML Q6_K super-block encodes 256 values in 210 bytes: 128 low-nibble bytes, 64 high-2-bit bytes, 16 signed int8 sub-scales, and a trailing f16 scale d.

Public fields

ql [128]u8
field ([128]u8)
qh [64]u8
field ([64]u8)
scales [16]i8
field ([16]i8)
d F16
field (F16)

read_q4_0

XuAPI
pub fn read_q4_0(storage &string, offset int) Q4Block

Purpose

Read q4 0. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)

Returns

Q4Block — a value of this type

read_q8_0

XuAPI
pub fn read_q8_0(storage &string, offset int) Q8Block

Purpose

Read q8 0. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)

Returns

Q8Block — a value of this type

(&Q4Block) at

XuAPI
pub fn (block &Q4Block) at(index int) f32

Purpose

Execute at on &Q4Block. Throws on failure; handle the error or propagate it to the caller.

Parameters

block &Q4Block
The Q4Block instance used by this call (borrow).
index int
index (int)

Returns

f32 — a value of this type

(&Q8Block) at

XuAPI
pub fn (block &Q8Block) at(index int) f32

Purpose

Execute at on &Q8Block. Throws on failure; handle the error or propagate it to the caller.

Parameters

block &Q8Block
The Q8Block instance used by this call (borrow).
index int
index (int)

Returns

f32 — a value of this type

(&Q4Block) append_f32

XuAPI
pub fn (block &Q4Block) append_f32(out $&[]f32)

Purpose

Operation on &Q4Block: append f32.

Parameters

block &Q4Block
The Q4Block instance used by this call (borrow).
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)

Returns

This call does not return a value.

(&Q8Block) append_f32

XuAPI
pub fn (block &Q8Block) append_f32(out $&[]f32)

Purpose

Operation on &Q8Block: append f32.

Parameters

block &Q8Block
The Q8Block instance used by this call (borrow).
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)

Returns

This call does not return a value.

read_q4_k

XuAPI
pub fn read_q4_k(storage &string, offset int) Q4KBlock

Purpose

Read q4 k. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)

Returns

Q4KBlock — a value of this type

(&Q4KBlock) at

XuAPI
pub fn (block &Q4KBlock) at(index int) f32

Purpose

Execute at on &Q4KBlock. Throws on failure; handle the error or propagate it to the caller.

Parameters

block &Q4KBlock
The Q4KBlock instance used by this call (borrow).
index int
index (int)

Returns

f32 — a value of this type

(&Q4KBlock) append_f32

XuAPI
pub fn (block &Q4KBlock) append_f32(out $&[]f32)

Purpose

Operation on &Q4KBlock: append f32.

Parameters

block &Q4KBlock
The Q4KBlock instance used by this call (borrow).
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)

Returns

This call does not return a value.

(&Q4KBlock) dot_f32

XuAPI
pub fn (block &Q4KBlock) dot_f32(x &[]f32, x_off int) f32

Purpose

Operation on &Q4KBlock: dot f32.

Parameters

block &Q4KBlock
The Q4KBlock instance used by this call (borrow).
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)

Returns

f32 — a value of this type

read_q5_k

XuAPI
pub fn read_q5_k(storage &string, offset int) Q5KBlock

Purpose

Read q5 k. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)

Returns

Q5KBlock — a value of this type

(&Q5KBlock) at

XuAPI
pub fn (block &Q5KBlock) at(index int) f32

Purpose

Execute at on &Q5KBlock. Throws on failure; handle the error or propagate it to the caller.

Parameters

block &Q5KBlock
The Q5KBlock instance used by this call (borrow).
index int
index (int)

Returns

f32 — a value of this type

(&Q5KBlock) append_f32

XuAPI
pub fn (block &Q5KBlock) append_f32(out $&[]f32)

Purpose

Operation on &Q5KBlock: append f32.

Parameters

block &Q5KBlock
The Q5KBlock instance used by this call (borrow).
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)

Returns

This call does not return a value.

(&Q5KBlock) dot_f32

XuAPI
pub fn (block &Q5KBlock) dot_f32(x &[]f32, x_off int) f32

Purpose

Operation on &Q5KBlock: dot f32.

Parameters

block &Q5KBlock
The Q5KBlock instance used by this call (borrow).
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)

Returns

f32 — a value of this type

read_q6_k

XuAPI
pub fn read_q6_k(storage &string, offset int) Q6KBlock

Purpose

Read q6 k. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)

Returns

Q6KBlock — a value of this type

(&Q6KBlock) at

XuAPI
pub fn (block &Q6KBlock) at(index int) f32

Purpose

Execute at on &Q6KBlock. Throws on failure; handle the error or propagate it to the caller.

Parameters

block &Q6KBlock
The Q6KBlock instance used by this call (borrow).
index int
index (int)

Returns

f32 — a value of this type

(&Q6KBlock) append_f32

XuAPI
pub fn (block &Q6KBlock) append_f32(out $&[]f32)

Purpose

Operation on &Q6KBlock: append f32.

Parameters

block &Q6KBlock
The Q6KBlock instance used by this call (borrow).
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)

Returns

This call does not return a value.

(&Q6KBlock) dot_f32

XuAPI
pub fn (block &Q6KBlock) dot_f32(x &[]f32, x_off int) f32

Purpose

Operation on &Q6KBlock: dot f32.

Parameters

block &Q6KBlock
The Q6KBlock instance used by this call (borrow).
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)

Returns

f32 — a value of this type

read_q5_0

XuAPI
pub fn read_q5_0(storage &string, offset int) Q5Block

Purpose

Read q5 0. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)

Returns

Q5Block — a value of this type

(&Q5Block) at

XuAPI
pub fn (block &Q5Block) at(index int) f32

Purpose

Execute at on &Q5Block. Throws on failure; handle the error or propagate it to the caller.

Parameters

block &Q5Block
The Q5Block instance used by this call (borrow).
index int
index (int)

Returns

f32 — a value of this type

(&Q5Block) append_f32

XuAPI
pub fn (block &Q5Block) append_f32(out $&[]f32)

Purpose

Operation on &Q5Block: append f32.

Parameters

block &Q5Block
The Q5Block instance used by this call (borrow).
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)

Returns

This call does not return a value.

(&Q5Block) dot_f32

XuAPI
pub fn (block &Q5Block) dot_f32(x &[]f32, x_off int) f32

Purpose

Operation on &Q5Block: dot f32.

Parameters

block &Q5Block
The Q5Block instance used by this call (borrow).
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)

Returns

f32 — a value of this type

q5_0_dot_f32

XuAPI
pub fn q5_0_dot_f32(storage &string, offset int, x &[]f32, x_off int) f32

Purpose

Zero-copy block dot products directly over caller-owned byte storage. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)

Returns

f32 — a value of this type

q8_0_dot_f32

XuAPI
pub fn q8_0_dot_f32(storage &string, offset int, x &[]f32, x_off int) f32

Purpose

Q8 0 dot f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)

Returns

f32 — a value of this type

q4_k_dot_f32

XuAPI
pub fn q4_k_dot_f32(storage &string, offset int, x &[]f32, x_off int) f32

Purpose

Q4 k dot f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)

Returns

f32 — a value of this type

q6_k_dot_f32

XuAPI
pub fn q6_k_dot_f32(storage &string, offset int, x &[]f32, x_off int) f32

Purpose

Q6 k dot f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)

Returns

f32 — a value of this type

dot_q5_0_row_f32

XuAPI
pub fn dot_q5_0_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32

Purpose

Bounds-checked once per row, avoiding per-block throwing calls and helpers. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

dot_q8_0_row_f32

XuAPI
pub fn dot_q8_0_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32

Purpose

Dot q8 0 row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

dot_q4_k_row_f32

XuAPI
pub fn dot_q4_k_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32

Purpose

Dot q4 k row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

dot_q6_k_row_f32

XuAPI
pub fn dot_q6_k_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32

Purpose

Dot q6 k row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

quantize_q5_0_row

XuAPI
pub fn quantize_q5_0_row(x &[]f32, out $&[]u8, n int)

Purpose

Quantize q5 0 row.

Parameters

x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
out $&[]u8
out (exclusive borrow; may modify the original; type $&[]u8)
n int
count, length, or limit (int)

Returns

This call does not return a value.

dequant_f16_to_f32

XuAPI
pub fn dequant_f16_to_f32(src &string, off int, dst $&[]f32, dst_off int, n int) int

Purpose

Dequant f16 to f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

src &string
source (read-only borrow; caller keeps the original; type &string)
off int
offset (int)
dst $&[]f32
destination (exclusive borrow; may modify the original; type $&[]f32)
dst_off int
dst_off (int)
n int
count, length, or limit (int)

Returns

int — a value of this type

dequant_bf16_to_f32

XuAPI
pub fn dequant_bf16_to_f32(src &string, off int, dst $&[]f32, dst_off int, n int) int

Purpose

Dequant bf16 to f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

src &string
source (read-only borrow; caller keeps the original; type &string)
off int
offset (int)
dst $&[]f32
destination (exclusive borrow; may modify the original; type $&[]f32)
dst_off int
dst_off (int)
n int
count, length, or limit (int)

Returns

int — a value of this type

quantize_q8_k_row

XuAPI
pub fn quantize_q8_k_row(x &[]f32, x_off int, qs $&[]i8, d_out $&[]f32, bsums $&[]int, n_blocks int) int

Purpose

Quantize q8 k row. Throws on failure; handle the error or propagate it to the caller.

Parameters

x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)
qs $&[]i8
qs (exclusive borrow; may modify the original; type $&[]i8)
d_out $&[]f32
d_out (exclusive borrow; may modify the original; type $&[]f32)
bsums $&[]int
bsums (exclusive borrow; may modify the original; type $&[]int)
n_blocks int
n_blocks (int)

Returns

int — a value of this type

dot_q4_k_q8_k_row_f32

XuAPI
pub fn dot_q4_k_q8_k_row_f32(storage &string, row_off int, q8_qs &[]i8, q8_d &[]f32, q8_bsums &[]int, n_blocks int) f32

Purpose

Dot q4 k q8 k row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
q8_qs &[]i8
q8_qs (read-only borrow; caller keeps the original; type &[]i8)
q8_d &[]f32
q8_d (read-only borrow; caller keeps the original; type &[]f32)
q8_bsums &[]int
q8_bsums (read-only borrow; caller keeps the original; type &[]int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

dot_q5_k_bytes_f32

XuAPI
pub fn dot_q5_k_bytes_f32(storage &string, offset int, x &[]f32, x_off int) f32

Purpose

Dot q5 k bytes f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)

Returns

f32 — a value of this type

dot_q5_k_row_f32

XuAPI
pub fn dot_q5_k_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32

Purpose

Dot q5 k row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

dot_q5_k_q8_k_row_f32

XuAPI
pub fn dot_q5_k_q8_k_row_f32(storage &string, row_off int, q8_qs &[]i8, q8_d &[]f32, q8_bsums &[]int, n_blocks int) f32

Purpose

Dot q5 k q8 k row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
q8_qs &[]i8
q8_qs (read-only borrow; caller keeps the original; type &[]i8)
q8_d &[]f32
q8_d (read-only borrow; caller keeps the original; type &[]f32)
q8_bsums &[]int
q8_bsums (read-only borrow; caller keeps the original; type &[]int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

dot_q6_k_q8_k_row_f32

XuAPI
pub fn dot_q6_k_q8_k_row_f32(storage &string, row_off int, q8_qs &[]i8, q8_d &[]f32, n_blocks int) f32

Purpose

Dot q6 k q8 k row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
q8_qs &[]i8
q8_qs (read-only borrow; caller keeps the original; type &[]i8)
q8_d &[]f32
q8_d (read-only borrow; caller keeps the original; type &[]f32)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

read_q4_1

XuAPI
pub fn read_q4_1(storage &string, offset int) Q41Block

Purpose

Read q4 1. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)

Returns

Q41Block — a value of this type

(&Q41Block) append_f32

XuAPI
pub fn (block &Q41Block) append_f32(out $&[]f32)

Purpose

Operation on &Q41Block: append f32.

Parameters

block &Q41Block
The Q41Block instance used by this call (borrow).
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)

Returns

This call does not return a value.

(&Q41Block) dot_f32

XuAPI
pub fn (block &Q41Block) dot_f32(x &[]f32, x_off int) f32

Purpose

Operation on &Q41Block: dot f32.

Parameters

block &Q41Block
The Q41Block instance used by this call (borrow).
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)

Returns

f32 — a value of this type

dot_q4_1_row_f32

XuAPI
pub fn dot_q4_1_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32

Purpose

Dot q4 1 row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

read_q5_1

XuAPI
pub fn read_q5_1(storage &string, offset int) Q51Block

Purpose

Read q5 1. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)

Returns

Q51Block — a value of this type

(&Q51Block) append_f32

XuAPI
pub fn (block &Q51Block) append_f32(out $&[]f32)

Purpose

Operation on &Q51Block: append f32.

Parameters

block &Q51Block
The Q51Block instance used by this call (borrow).
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)

Returns

This call does not return a value.

(&Q51Block) dot_f32

XuAPI
pub fn (block &Q51Block) dot_f32(x &[]f32, x_off int) f32

Purpose

Operation on &Q51Block: dot f32.

Parameters

block &Q51Block
The Q51Block instance used by this call (borrow).
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)

Returns

f32 — a value of this type

dot_q5_1_row_f32

XuAPI
pub fn dot_q5_1_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32

Purpose

Dot q5 1 row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

read_q2_k

XuAPI
pub fn read_q2_k(storage &string, offset int) Q2KBlock

Purpose

Read q2 k. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)

Returns

Q2KBlock — a value of this type

(&Q2KBlock) append_f32

XuAPI
pub fn (block &Q2KBlock) append_f32(out $&[]f32)

Purpose

Operation on &Q2KBlock: append f32.

Parameters

block &Q2KBlock
The Q2KBlock instance used by this call (borrow).
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)

Returns

This call does not return a value.

dot_q2_k_row_f32

XuAPI
pub fn dot_q2_k_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32

Purpose

Dot q2 k row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

dot_q2_k_q8_k_row_f32

XuAPI
pub fn dot_q2_k_q8_k_row_f32(storage &string, row_off int, q8_qs &[]i8, q8_d &[]f32, q8_bsums &[]int, n_blocks int) f32

Purpose

Dot q2 k q8 k row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
q8_qs &[]i8
q8_qs (read-only borrow; caller keeps the original; type &[]i8)
q8_d &[]f32
q8_d (read-only borrow; caller keeps the original; type &[]f32)
q8_bsums &[]int
q8_bsums (read-only borrow; caller keeps the original; type &[]int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

read_q3_k

XuAPI
pub fn read_q3_k(storage &string, offset int) Q3KBlock

Purpose

Read q3 k. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
offset int
offset (int)

Returns

Q3KBlock — a value of this type

(&Q3KBlock) append_f32

XuAPI
pub fn (block &Q3KBlock) append_f32(out $&[]f32)

Purpose

Operation on &Q3KBlock: append f32.

Parameters

block &Q3KBlock
The Q3KBlock instance used by this call (borrow).
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)

Returns

This call does not return a value.

dot_q3_k_row_f32

XuAPI
pub fn dot_q3_k_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32

Purpose

Dot q3 k row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
x &[]f32
value (read-only borrow; caller keeps the original; type &[]f32)
x_off int
x_off (int)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

dot_q3_k_q8_k_row_f32

XuAPI
pub fn dot_q3_k_q8_k_row_f32(storage &string, row_off int, q8_qs &[]i8, q8_d &[]f32, n_blocks int) f32

Purpose

Dot q3 k q8 k row f32. Throws on failure; handle the error or propagate it to the caller.

Parameters

storage &string
storage (read-only borrow; caller keeps the original; type &string)
row_off int
row_off (int)
q8_qs &[]i8
q8_qs (read-only borrow; caller keeps the original; type &[]i8)
q8_d &[]f32
q8_d (read-only borrow; caller keeps the original; type &[]f32)
n_blocks int
n_blocks (int)

Returns

f32 — a value of this type

struct TensorView

XuAPI
pub struct TensorView {

}

Purpose

TensorView describes a dense tensor in caller-owned little-endian storage. Offsets are in bytes. Strides are in elements and can be zero for broadcast.

Public fields

This type has no public fields.

strided_view

XuAPI
pub fn strided_view(kind DType, shape &[]int, strides &[]int, byte_offset int, storage_bytes int) TensorView

Purpose

Create a view over storage_bytes bytes and validate the entire reachable span. Throws on failure; handle the error or propagate it to the caller.

Parameters

kind DType
kind tag (DType)
shape &[]int
shape (read-only borrow; caller keeps the original; type &[]int)
strides &[]int
strides (read-only borrow; caller keeps the original; type &[]int)
byte_offset int
byte_offset (int)
storage_bytes int
storage_bytes (int)

Returns

TensorView — a value of this type

contiguous_view

XuAPI
pub fn contiguous_view(kind DType, shape &[]int, byte_offset int, storage_bytes int) TensorView

Purpose

Create a row-major view. An empty shape is a scalar and a zero axis is empty. Throws on failure; handle the error or propagate it to the caller.

Parameters

kind DType
kind tag (DType)
shape &[]int
shape (read-only borrow; caller keeps the original; type &[]int)
byte_offset int
byte_offset (int)
storage_bytes int
storage_bytes (int)

Returns

TensorView — a value of this type

(&TensorView) dtype

XuAPI
pub fn (v &TensorView) dtype() DType

Purpose

Execute dtype on &TensorView.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).

Returns

DType — a value of this type

(&TensorView) rank

XuAPI
pub fn (v &TensorView) rank() int

Purpose

Execute rank on &TensorView.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).

Returns

int — a value of this type

(&TensorView) element_count

XuAPI
pub fn (v &TensorView) element_count() int

Purpose

Operation on &TensorView: element count.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).

Returns

int — a value of this type

(&TensorView) storage_start

XuAPI
pub fn (v &TensorView) storage_start() int

Purpose

Operation on &TensorView: storage start.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).

Returns

int — a value of this type

(&TensorView) storage_end

XuAPI
pub fn (v &TensorView) storage_end() int

Purpose

Operation on &TensorView: storage end.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).

Returns

int — a value of this type

(&TensorView) is_contiguous

XuAPI
pub fn (v &TensorView) is_contiguous() bool

Purpose

Operation on &TensorView: whether it is contiguous.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).

Returns

bool — true or false

(&TensorView) dimension

XuAPI
pub fn (v &TensorView) dimension(axis int) int

Purpose

Execute dimension on &TensorView. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
axis int
axis (int)

Returns

int — a value of this type

(&TensorView) stride

XuAPI
pub fn (v &TensorView) stride(axis int) int

Purpose

Execute stride on &TensorView. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
axis int
axis (int)

Returns

int — a value of this type

(&TensorView) transpose

XuAPI
pub fn (v &TensorView) transpose(a int, b int) TensorView

Purpose

Swap two axes and keep the same caller-owned buffer. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
a int
value (int)
b int
b (int)

Returns

TensorView — a value of this type

(&TensorView) slice

XuAPI
pub fn (v &TensorView) slice(axis int, first int, stop int, step int) TensorView

Purpose

Slice one axis over [first, stop) with a positive element step. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
axis int
axis (int)
first int
first (int)
stop int
stop (int)
step int
step (int)

Returns

TensorView — a value of this type

(&TensorView) reshape

XuAPI
pub fn (v &TensorView) reshape(new_shape &[]int) TensorView

Purpose

Reshape a contiguous view without copying the backing bytes. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
new_shape &[]int
new_shape (read-only borrow; caller keeps the original; type &[]int)

Returns

TensorView — a value of this type

(&TensorView) permute

XuAPI
pub fn (v &TensorView) permute(axes &[]int) TensorView

Purpose

Reorder axes without copying the backing bytes. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
axes &[]int
axes (read-only borrow; caller keeps the original; type &[]int)

Returns

TensorView — a value of this type

(&TensorView) byte_offset

XuAPI
pub fn (v &TensorView) byte_offset(indices &[]int) int

Purpose

Operation on &TensorView: byte offset. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
indices &[]int
indices (read-only borrow; caller keeps the original; type &[]int)

Returns

int — a value of this type

(&TensorView) read_f32

XuAPI
pub fn (v &TensorView) read_f32(storage &string, indices &[]int) f32

Purpose

Read one scalar without copying or taking ownership of the storage. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
storage &string
storage (read-only borrow; caller keeps the original; type &string)
indices &[]int
indices (read-only borrow; caller keeps the original; type &[]int)

Returns

f32 — a value of this type

(&TensorView) read_f32_linear

XuAPI
pub fn (v &TensorView) read_f32_linear(storage &string, linear int) f32

Purpose

Read by logical row-major index, including transposed and stepped views. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
storage &string
storage (read-only borrow; caller keeps the original; type &string)
linear int
linear (int)

Returns

f32 — a value of this type

(&TensorView) append_f32

XuAPI
pub fn (v &TensorView) append_f32(storage &string, out $&[]f32) int

Purpose

Append decoded values in logical row-major order after validating storage. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
storage &string
storage (read-only borrow; caller keeps the original; type &string)
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)

Returns

int — a value of this type

(&TensorView) copy_f32

XuAPI
pub fn (v &TensorView) copy_f32(storage &string, first int, count int, out $&[]f32, output_offset int) int

Purpose

Decode a logical range into an existing output buffer. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
storage &string
storage (read-only borrow; caller keeps the original; type &string)
first int
first (int)
count int
count (int)
out $&[]f32
out (exclusive borrow; may modify the original; type $&[]f32)
output_offset int
output_offset (int)

Returns

int — a value of this type

(&TensorView) read_f32_bytes

XuAPI
pub fn (v &TensorView) read_f32_bytes(storage &[]u8, indices &[]int) f32

Purpose

Read one scalar from a mutable []u8 backing buffer. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
storage &[]u8
storage (read-only borrow; caller keeps the original; type &[]u8)
indices &[]int
indices (read-only borrow; caller keeps the original; type &[]int)

Returns

f32 — a value of this type

(&TensorView) write_f32_bytes

XuAPI
pub fn (v &TensorView) write_f32_bytes(storage $&[]u8, indices &[]int, value f32) int

Purpose

Encode and write one scalar into a caller-owned []u8 backing buffer. Throws on failure; handle the error or propagate it to the caller.

Parameters

v &TensorView
The TensorView instance used by this call (borrow).
storage $&[]u8
storage (exclusive borrow; may modify the original; type $&[]u8)
indices &[]int
indices (read-only borrow; caller keeps the original; type &[]int)
value f32
value (f32)

Returns

int — a value of this type