struct DType
pub struct DType {
}用途
DType 上下文或状态结构体。
公开字段
此类型没有公开字段。
#tensor标准库包 `#tensor`。
struct DTypepub struct DType {
}DType 上下文或状态结构体。
此类型没有公开字段。
dtype_f32pub fn dtype_f32() DType执行 dtype f32 操作。
无需传入参数。
DType — 该类型的值
dtype_f16pub fn dtype_f16() DType执行 dtype f16 操作。
无需传入参数。
DType — 该类型的值
dtype_bf16pub fn dtype_bf16() DType执行 dtype bf16 操作。
无需传入参数。
DType — 该类型的值
dtype_fp8_e4m3fnpub fn dtype_fp8_e4m3fn() DType执行 dtype fp8 e4m3fn 操作。
无需传入参数。
DType — 该类型的值
dtype_fp8_e5m2pub fn dtype_fp8_e5m2() DType执行 dtype fp8 e5m2 操作。
无需传入参数。
DType — 该类型的值
dtype_fp8_e4m3fnuzpub fn dtype_fp8_e4m3fnuz() DType执行 dtype fp8 e4m3fnuz 操作。
无需传入参数。
DType — 该类型的值
dtype_fp8_e5m2fnuzpub fn dtype_fp8_e5m2fnuz() DType执行 dtype fp8 e5m2fnuz 操作。
无需传入参数。
DType — 该类型的值
(DType) is_f32pub fn (dtype DType) is_f32() boolDType 上的操作:判断是否 f32。
dtype DTypeDType 实例;按值接收。bool — 是否成立
(DType) element_bytespub fn (dtype DType) element_bytes() intDType 上的操作:执行 element bytes 操作。
dtype DTypeDType 实例;按值接收。int — 该类型的值
(DType) decode_bitspub fn (dtype DType) decode_bits(raw int) f32DType 上的操作:解码 bits 数据。
dtype DTypeDType 实例;按值接收。raw intf32 — 该类型的值
(DType) encode_bitspub fn (dtype DType) encode_bits(value f32) intDType 上的操作:编码 bits 数据。
dtype DTypeDType 实例;按值接收。value f32int — 该类型的值
safetensors_dtypepub fn safetensors_dtype(name &string) DType执行 safetensors dtype 操作。失败时抛出错误,调用方需处理或继续传播。
name &stringDType — 该类型的值
dtype_namedpub fn dtype_named(name &string) DType执行 dtype named 操作。失败时抛出错误,调用方需处理或继续传播。
name &stringDType — 该类型的值
struct F16pub struct F16 {
pub bits u16
}承载 bits 等属性的结构体。
bits u16struct BF16pub struct BF16 {
pub bits u16
}承载 bits 等属性的结构体。
bits u16struct Fp8E4M3Fnpub struct Fp8E4M3Fn {
pub bits u8
}承载 bits 等属性的结构体。
bits u8struct Fp8E5M2pub struct Fp8E5M2 {
pub bits u8
}承载 bits 等属性的结构体。
bits u8struct Fp8E4M3Fnuzpub struct Fp8E4M3Fnuz {
pub bits u8
}承载 bits 等属性的结构体。
bits u8struct Fp8E5M2Fnuzpub struct Fp8E5M2Fnuz {
pub bits u8
}承载 bits 等属性的结构体。
bits u8f16pub fn f16(value f32) F16执行 f16 处理。
value f32F16 — 该类型的值
(&F16) to_f32pub fn (x &F16) to_f32() f32&F16 上的操作:转换为 f32。
x &F16F16 实例;以只读借用传入,调用方仍持有实例。f32 — 该类型的值
bf16pub fn bf16(value f32) BF16执行 bf16 处理。
value f32BF16 — 该类型的值
(&BF16) to_f32pub fn (x &BF16) to_f32() f32&BF16 上的操作:转换为 f32。
x &BF16BF16 实例;以只读借用传入,调用方仍持有实例。f32 — 该类型的值
fp8_e4m3fnpub fn fp8_e4m3fn(value f32) Fp8E4M3Fnfp8e4m3fn。
value f32Fp8E4M3Fn — 该类型的值
fp8_e5m2pub fn fp8_e5m2(value f32) Fp8E5M2fp8e5m2。
value f32Fp8E5M2 — 该类型的值
fp8_e4m3fnuzpub fn fp8_e4m3fnuz(value f32) Fp8E4M3Fnuzfp8e4m3fnuz。
value f32Fp8E4M3Fnuz — 该类型的值
fp8_e5m2fnuzpub fn fp8_e5m2fnuz(value f32) Fp8E5M2Fnuzfp8e5m2fnuz。
value f32Fp8E5M2Fnuz — 该类型的值
(&Fp8E4M3Fn) to_f32pub fn (x &Fp8E4M3Fn) to_f32() f32&Fp8E4M3Fn 上的操作:转换为 f32。
x &Fp8E4M3FnFp8E4M3Fn 实例;以只读借用传入,调用方仍持有实例。f32 — 该类型的值
(&Fp8E5M2) to_f32pub fn (x &Fp8E5M2) to_f32() f32&Fp8E5M2 上的操作:转换为 f32。
x &Fp8E5M2Fp8E5M2 实例;以只读借用传入,调用方仍持有实例。f32 — 该类型的值
(&Fp8E4M3Fnuz) to_f32pub fn (x &Fp8E4M3Fnuz) to_f32() f32&Fp8E4M3Fnuz 上的操作:转换为 f32。
x &Fp8E4M3FnuzFp8E4M3Fnuz 实例;以只读借用传入,调用方仍持有实例。f32 — 该类型的值
(&Fp8E5M2Fnuz) to_f32pub fn (x &Fp8E5M2Fnuz) to_f32() f32&Fp8E5M2Fnuz 上的操作:转换为 f32。
x &Fp8E5M2FnuzFp8E5M2Fnuz 实例;以只读借用传入,调用方仍持有实例。f32 — 该类型的值
dot_f32pub fn dot_f32(a &[]f32, b &[]f32, n int) f32执行 dot f32 操作。
a &[]f32b &[]f32n intf32 — 该类型的值
axpy_f32pub fn axpy_f32(dst $&[]f32, src &[]f32, alpha f32, n int)执行 axpy f32 操作。
dst $&[]f32src &[]f32alpha f32n int不返回值。
vadd_f32pub fn vadd_f32(dst $&[]f32, src &[]f32, n int)执行 vadd f32 操作。
dst $&[]f32src &[]f32n int不返回值。
vmul_f32pub fn vmul_f32(out $&[]f32, a &[]f32, b &[]f32, n int)执行 vmul f32 操作。
out $&[]f32a &[]f32b &[]f32n int不返回值。
vscale_f32pub fn vscale_f32(dst $&[]f32, scale f32, n int)执行 vscale f32 操作。
dst $&[]f32scale f32n int不返回值。
rmsnorm_f32pub fn rmsnorm_f32(out $&[]f32, x &[]f32, weight &[]f32, n int, eps f64)执行 rmsnorm f32 操作。
out $&[]f32x &[]f32weight &[]f32n inteps f64不返回值。
softmax_f32pub fn softmax_f32(scores $&[]f32, n int, scale f32)执行 softmax f32 操作。
scores $&[]f32n intscale f32不返回值。
swiglu_f32pub fn swiglu_f32(out $&[]f32, gate &[]f32, up &[]f32, n int)执行 swiglu f32 操作。
out $&[]f32gate &[]f32up &[]f32n int不返回值。
matvec_f32pub fn matvec_f32(out $&[]f32, x &[]f32, weights &[]f32, rows int, cols int)执行 matvec f32 操作。
out $&[]f32x &[]f32weights &[]f32rows intcols int不返回值。
matmul_f32pub fn matmul_f32(out $&[]f32, x &[]f32, weights &[]f32, m_cnt int, rows int, cols int)执行 matmul f32 操作。
out $&[]f32x &[]f32weights &[]f32m_cnt introws intcols int不返回值。
argmax_f32pub fn argmax_f32(x &[]f32, n int) int执行 argmax f32 操作。
x &[]f32n intint — 该类型的值
quantize_q8_0pub fn quantize_q8_0(x &[]f32, xq $&[]i8, scales $&[]f32, n int)执行 quantize q8 0 操作。
x &[]f32xq $&[]i8scales $&[]f32n int不返回值。
vsub_f32pub fn vsub_f32(out $&[]f32, a &[]f32, b &[]f32, n int)执行 vsub f32 操作。
out $&[]f32a &[]f32b &[]f32n int不返回值。
silu_f32pub fn silu_f32(out $&[]f32, x &[]f32, n int)执行 silu f32 操作。
out $&[]f32x &[]f32n int不返回值。
gelu_f32pub fn gelu_f32(out $&[]f32, x &[]f32, n int)执行 gelu f32 操作。
out $&[]f32x &[]f32n int不返回值。
layernorm_f32pub fn layernorm_f32(out $&[]f32, x &[]f32, weight &[]f32, bias &[]f32, n int, eps f64)执行 layernorm f32 操作。
out $&[]f32x &[]f32weight &[]f32bias &[]f32n inteps f64不返回值。
l2_normalize_f32pub fn l2_normalize_f32(out $&[]f32, x &[]f32, n int, eps f64)执行 l2 normalize f32 操作。
out $&[]f32x &[]f32n inteps f64不返回值。
cosine_similarity_f32pub fn cosine_similarity_f32(a &[]f32, b &[]f32, n int) f32执行 cosine similarity f32 操作。
a &[]f32b &[]f32n intf32 — 该类型的值
rope_f32pub fn rope_f32(vec $&[]f32, n_heads int, head_dim int, pos int, theta f64)执行 rope f32 操作。
vec $&[]f32n_heads inthead_dim intpos inttheta f64不返回值。
quantize_q4_0_rowpub fn quantize_q4_0_row(x &[]f32, qs $&[]u8, scales $&[]f32, n int)执行 quantize q4 0 row 操作。
x &[]f32qs $&[]u8scales $&[]f32n int不返回值。
rope_interleaved_f32pub fn rope_interleaved_f32(vec $&[]f32, n_heads int, head_dim int, pos int, theta f64)执行 rope interleaved f32 操作。
vec $&[]f32n_heads inthead_dim intpos inttheta f64不返回值。
geglu_f32pub fn geglu_f32(out $&[]f32, gate &[]f32, up &[]f32, n int)执行 geglu f32 操作。
out $&[]f32gate &[]f32up &[]f32n int不返回值。
log_softmax_f32pub fn log_softmax_f32(scores $&[]f32, n int)执行 log softmax f32 操作。
scores $&[]f32n int不返回值。
add_rmsnorm_f32pub fn add_rmsnorm_f32(norm_out $&[]f32, residual_out $&[]f32, x &[]f32, residual &[]f32, weight &[]f32, n int, eps f64)执行 add rmsnorm f32 操作。
norm_out $&[]f32residual_out $&[]f32x &[]f32residual &[]f32weight &[]f32n inteps f64不返回值。
topk_f32pub fn topk_f32(x &[]f32, n int, k int, out_idx $&[]int, out_val $&[]f32) int执行 topk f32 操作。
x &[]f32n intk intout_idx $&[]intout_val $&[]f32int — 该类型的值
moe_router_f32pub 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执行 moe router f32 操作。
logits &[]f32n_experts inttop_k intuse_sigmoid boolnorm_topk boolscale f64bias &[]f32out_idx $&[]intout_w $&[]f32int — 该类型的值
rope_yarn_f32pub 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)执行 rope yarn f32 操作。
vec $&[]f32n_heads inthead_dim intrope_dim intinterleaved boolpos inttheta f64scale f64orig_ctx intbeta_fast f64beta_slow f64attn_factor f64不返回值。
topk_cosine_f32pub fn topk_cosine_f32(query &[]f32, corpus &[]f32, n_docs int, dim int, k int, out_idx $&[]int, out_score $&[]f32) int执行 topk cosine f32 操作。
query &[]f32corpus &[]f32n_docs intdim intk intout_idx $&[]intout_score $&[]f32int — 该类型的值
cross_entropy_grad_f32pub fn cross_entropy_grad_f32(dlogits $&[]f32, logits &[]f32, target int, n int) f32执行 cross entropy grad f32 操作。
dlogits $&[]f32logits &[]f32target intn intf32 — 该类型的值
adamw_step_f32pub 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)执行 adamw step f32 操作。
param $&[]f32grad &[]f32m $&[]f32v $&[]f32n intlr f32beta1 f32beta2 f32eps f32weight_decay f32step int不返回值。
lora_add_f32pub fn lora_add_f32(out $&[]f32, x &[]f32, a &[]f32, b &[]f32, rows int, cols int, rank int, scale f32)执行 lora add f32 操作。
out $&[]f32x &[]f32a &[]f32b &[]f32rows intcols intrank intscale f32不返回值。
lora_backward_f32pub 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)执行 lora backward f32 操作。
dx $&[]f32da $&[]f32db $&[]f32dy &[]f32x &[]f32a &[]f32b &[]f32out_dim intin_dim intrank intscale f64不返回值。
rmsnorm_backward_f32pub fn rmsnorm_backward_f32(dx $&[]f32, dw $&[]f32, dy &[]f32, x &[]f32, w &[]f32, n int, eps f64)执行 rmsnorm backward f32 操作。
dx $&[]f32dw $&[]f32dy &[]f32x &[]f32w &[]f32n inteps f64不返回值。
swiglu_backward_f32pub fn swiglu_backward_f32(dgate $&[]f32, dup $&[]f32, dy &[]f32, gate &[]f32, up &[]f32, n int)执行 swiglu backward f32 操作。
dgate $&[]f32dup $&[]f32dy &[]f32gate &[]f32up &[]f32n int不返回值。
layernorm_backward_f32pub fn layernorm_backward_f32(dx $&[]f32, dw $&[]f32, db $&[]f32, dy &[]f32, x &[]f32, weight &[]f32, n int, eps f64)执行 layernorm backward f32 操作。
dx $&[]f32dw $&[]f32db $&[]f32dy &[]f32x &[]f32weight &[]f32n inteps f64不返回值。
softmax_backward_f32pub fn softmax_backward_f32(dx $&[]f32, dy &[]f32, probs &[]f32, n int)执行 softmax backward f32 操作。
dx $&[]f32dy &[]f32probs &[]f32n int不返回值。
grad_clip_norm_f32pub fn grad_clip_norm_f32(grad $&[]f32, n int, max_norm f32) f32执行 grad clip norm f32 操作。
grad $&[]f32n intmax_norm f32f32 — 该类型的值
kl_div_grad_f32pub fn kl_div_grad_f32(grad_student $&[]f32, student_logits &[]f32, teacher_logits &[]f32, n int, temperature f32) f32执行 kl div grad f32 操作。
grad_student $&[]f32student_logits &[]f32teacher_logits &[]f32n inttemperature f32f32 — 该类型的值
dpo_loss_grad_f32pub 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执行 dpo loss grad f32 操作。
pi_chosen_logp f32pi_rejected_logp f32ref_chosen_logp f32ref_rejected_logp f32beta f32out_grad $&[]f32f32 — 该类型的值
grpo_advantages_f32pub fn grpo_advantages_f32(out_adv $&[]f32, rewards &[]f32, n int, eps f32)执行 grpo advantages f32 操作。
out_adv $&[]f32rewards &[]f32n inteps f32不返回值。
conv1d_causal_step_f32pub fn conv1d_causal_step_f32(out $&[]f32, state $&[]f32, x &[]f32, weight &[]f32, bias &[]f32, d_inner int, k_size int)执行 conv1d causal step f32 操作。
out $&[]f32state $&[]f32x &[]f32weight &[]f32bias &[]f32d_inner intk_size int不返回值。
ssm_scan_step_f32pub 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)执行 ssm scan step f32 操作。
out $&[]f32state $&[]f32x &[]f32dt &[]f32a_log &[]f32b_vec &[]f32c_vec &[]f32d_skip &[]f32d_inner intd_state int不返回值。
linear_attn_step_f32pub 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)执行 linear attn step f32 操作。
out $&[]f32state $&[]f32z_state $&[]f32q &[]f32k &[]f32v &[]f32decay f32n_heads inthead_dim inteps f32不返回值。
ppo_clip_grad_f32pub 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执行 ppo clip grad f32 操作。
new_logp f32old_logp f32ref_logp f32advantage f32clip_eps f32kl_beta f32out_grad $&[]f32f32 — 该类型的值
conv2d_patch_embed_f32pub 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)执行 conv2d patch embed f32 操作。
out $&[]f32img &[]f32weight &[]f32bias &[]f32in_c intimg_h intimg_w intout_c intpatch int不返回值。
mha_sdpa_f32pub 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)执行 mha sdpa f32 操作。
out $&[]f32q &[]f32k &[]f32v &[]f32seq_q intseq_k intn_heads inthead_dim intcausal bool不返回值。
avg_pool2d_f32pub fn avg_pool2d_f32(out $&[]f32, x &[]f32, channels int, h int, w int, kernel int, stride int)执行 avg pool2d f32 操作。
out $&[]f32x &[]f32channels inth intw intkernel intstride int不返回值。
const GGML_BLOCK_VALUESpub const GGML_BLOCK_VALUES = 32常量 GGML_BLOCK_VALUES,定义了相关的协议或算法配置参数。
const Q4_0_BYTESpub const Q4_0_BYTES = 18常量 Q4_0_BYTES,定义了相关的协议或算法配置参数。
const Q4_1_BYTESpub const Q4_1_BYTES = 20常量 Q4_1_BYTES,定义了相关的协议或算法配置参数。
const Q5_0_BYTESpub const Q5_0_BYTES = 22常量 Q5_0_BYTES,定义了相关的协议或算法配置参数。
const Q5_1_BYTESpub const Q5_1_BYTES = 24常量 Q5_1_BYTES,定义了相关的协议或算法配置参数。
const Q8_0_BYTESpub const Q8_0_BYTES = 34常量 Q8_0_BYTES,定义了相关的协议或算法配置参数。
const QK_Kpub const QK_K = 256常量 QK_K,定义了相关的协议或算法配置参数。
const Q2_K_BYTESpub const Q2_K_BYTES = 84常量 Q2_K_BYTES,定义了相关的协议或算法配置参数。
const Q3_K_BYTESpub const Q3_K_BYTES = 110常量 Q3_K_BYTES,定义了相关的协议或算法配置参数。
const Q4_K_BYTESpub const Q4_K_BYTES = 144常量 Q4_K_BYTES,定义了相关的协议或算法配置参数。
const Q5_K_BYTESpub const Q5_K_BYTES = 176常量 Q5_K_BYTES,定义了相关的协议或算法配置参数。
const Q6_K_BYTESpub const Q6_K_BYTES = 210常量 Q6_K_BYTES,定义了相关的协议或算法配置参数。
const Q8_K_BYTESpub const Q8_K_BYTES = 292常量 Q8_K_BYTES,定义了相关的协议或算法配置参数。
struct Q4Blockpub struct Q4Block {
pub scale F16
pub packed [16]u8
}承载 scale、packed 等属性的结构体。
scale F16packed [16]u8struct Q41Blockpub struct Q41Block {
pub d F16
pub m F16
pub qs [16]u8
}承载 d、m、qs 等属性的结构体。
d F16m F16qs [16]u8struct Q51Blockpub struct Q51Block {
pub d F16
pub m F16
pub qh [4]u8
pub qs [16]u8
}承载 d、m、qh、qs 等属性的结构体。
d F16m F16qh [4]u8qs [16]u8struct Q2KBlockpub struct Q2KBlock {
pub scales [16]u8
pub qs [64]u8
pub d F16
pub dmin F16
}承载 scales、qs、d、dmin 等属性的结构体。
scales [16]u8qs [64]u8d F16dmin F16struct Q3KBlockpub struct Q3KBlock {
pub hmask [32]u8
pub qs [64]u8
pub scales [12]u8
pub d F16
}承载 hmask、qs、scales、d 等属性的结构体。
hmask [32]u8qs [64]u8scales [12]u8d F16struct Q5Blockpub struct Q5Block {
pub scale F16
pub qh [4]u8
pub qs [16]u8
}承载 scale、qh、qs 等属性的结构体。
scale F16qh [4]u8qs [16]u8struct Q8Blockpub struct Q8Block {
pub scale F16
pub quants [32]i8
}承载 scale、quants 等属性的结构体。
scale F16quants [32]i8struct Q4KBlockpub struct Q4KBlock {
pub d F16
pub dmin F16
pub scales [12]u8
pub qs [128]u8
}承载 d、dmin、scales、qs 等属性的结构体。
d F16dmin F16scales [12]u8qs [128]u8struct Q5KBlockpub struct Q5KBlock {
pub d F16
pub dmin F16
pub scales [12]u8
pub qh [32]u8
pub qs [128]u8
}承载 d、dmin、scales、qh、qs 等属性的结构体。
d F16dmin F16scales [12]u8qh [32]u8qs [128]u8struct Q6KBlockpub struct Q6KBlock {
pub ql [128]u8
pub qh [64]u8
pub scales [16]i8
pub d F16
}承载 ql、qh、scales、d 等属性的结构体。
ql [128]u8qh [64]u8scales [16]i8d F16read_q4_0pub fn read_q4_0(storage &string, offset int) Q4Block读取q40。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intQ4Block — 该类型的值
read_q8_0pub fn read_q8_0(storage &string, offset int) Q8Block读取q80。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intQ8Block — 该类型的值
(&Q4Block) atpub fn (block &Q4Block) at(index int) f32在 &Q4Block 上执行 at 操作。失败时抛出错误,调用方需处理或继续传播。
block &Q4BlockQ4Block 实例;以只读借用传入,调用方仍持有实例。index intf32 — 该类型的值
(&Q8Block) atpub fn (block &Q8Block) at(index int) f32在 &Q8Block 上执行 at 操作。失败时抛出错误,调用方需处理或继续传播。
block &Q8BlockQ8Block 实例;以只读借用传入,调用方仍持有实例。index intf32 — 该类型的值
(&Q4Block) append_f32pub fn (block &Q4Block) append_f32(out $&[]f32)&Q4Block 上的操作:追加f32。
block &Q4BlockQ4Block 实例;以只读借用传入,调用方仍持有实例。out $&[]f32不返回值。
(&Q8Block) append_f32pub fn (block &Q8Block) append_f32(out $&[]f32)&Q8Block 上的操作:追加f32。
block &Q8BlockQ8Block 实例;以只读借用传入,调用方仍持有实例。out $&[]f32不返回值。
read_q4_kpub fn read_q4_k(storage &string, offset int) Q4KBlock执行 read q4 k 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intQ4KBlock — 该类型的值
(&Q4KBlock) atpub fn (block &Q4KBlock) at(index int) f32在 &Q4KBlock 上执行 at 操作。失败时抛出错误,调用方需处理或继续传播。
block &Q4KBlockQ4KBlock 实例;以只读借用传入,调用方仍持有实例。index intf32 — 该类型的值
(&Q4KBlock) append_f32pub fn (block &Q4KBlock) append_f32(out $&[]f32)&Q4KBlock 上的操作:追加f32。
block &Q4KBlockQ4KBlock 实例;以只读借用传入,调用方仍持有实例。out $&[]f32不返回值。
(&Q4KBlock) dot_f32pub fn (block &Q4KBlock) dot_f32(x &[]f32, x_off int) f32&Q4KBlock 上的操作:执行 dot f32 操作。
block &Q4KBlockQ4KBlock 实例;以只读借用传入,调用方仍持有实例。x &[]f32x_off intf32 — 该类型的值
read_q5_kpub fn read_q5_k(storage &string, offset int) Q5KBlock执行 read q5 k 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intQ5KBlock — 该类型的值
(&Q5KBlock) atpub fn (block &Q5KBlock) at(index int) f32在 &Q5KBlock 上执行 at 操作。失败时抛出错误,调用方需处理或继续传播。
block &Q5KBlockQ5KBlock 实例;以只读借用传入,调用方仍持有实例。index intf32 — 该类型的值
(&Q5KBlock) append_f32pub fn (block &Q5KBlock) append_f32(out $&[]f32)&Q5KBlock 上的操作:追加f32。
block &Q5KBlockQ5KBlock 实例;以只读借用传入,调用方仍持有实例。out $&[]f32不返回值。
(&Q5KBlock) dot_f32pub fn (block &Q5KBlock) dot_f32(x &[]f32, x_off int) f32&Q5KBlock 上的操作:执行 dot f32 操作。
block &Q5KBlockQ5KBlock 实例;以只读借用传入,调用方仍持有实例。x &[]f32x_off intf32 — 该类型的值
read_q6_kpub fn read_q6_k(storage &string, offset int) Q6KBlock执行 read q6 k 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intQ6KBlock — 该类型的值
(&Q6KBlock) atpub fn (block &Q6KBlock) at(index int) f32在 &Q6KBlock 上执行 at 操作。失败时抛出错误,调用方需处理或继续传播。
block &Q6KBlockQ6KBlock 实例;以只读借用传入,调用方仍持有实例。index intf32 — 该类型的值
(&Q6KBlock) append_f32pub fn (block &Q6KBlock) append_f32(out $&[]f32)&Q6KBlock 上的操作:追加f32。
block &Q6KBlockQ6KBlock 实例;以只读借用传入,调用方仍持有实例。out $&[]f32不返回值。
(&Q6KBlock) dot_f32pub fn (block &Q6KBlock) dot_f32(x &[]f32, x_off int) f32&Q6KBlock 上的操作:执行 dot f32 操作。
block &Q6KBlockQ6KBlock 实例;以只读借用传入,调用方仍持有实例。x &[]f32x_off intf32 — 该类型的值
read_q5_0pub fn read_q5_0(storage &string, offset int) Q5Block读取q50。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intQ5Block — 该类型的值
(&Q5Block) atpub fn (block &Q5Block) at(index int) f32在 &Q5Block 上执行 at 操作。失败时抛出错误,调用方需处理或继续传播。
block &Q5BlockQ5Block 实例;以只读借用传入,调用方仍持有实例。index intf32 — 该类型的值
(&Q5Block) append_f32pub fn (block &Q5Block) append_f32(out $&[]f32)&Q5Block 上的操作:追加f32。
block &Q5BlockQ5Block 实例;以只读借用传入,调用方仍持有实例。out $&[]f32不返回值。
(&Q5Block) dot_f32pub fn (block &Q5Block) dot_f32(x &[]f32, x_off int) f32&Q5Block 上的操作:执行 dot f32 操作。
block &Q5BlockQ5Block 实例;以只读借用传入,调用方仍持有实例。x &[]f32x_off intf32 — 该类型的值
q5_0_dot_f32pub fn q5_0_dot_f32(storage &string, offset int, x &[]f32, x_off int) f32执行 q5 0 dot f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intx &[]f32x_off intf32 — 该类型的值
q8_0_dot_f32pub fn q8_0_dot_f32(storage &string, offset int, x &[]f32, x_off int) f32执行 q8 0 dot f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intx &[]f32x_off intf32 — 该类型的值
q4_k_dot_f32pub fn q4_k_dot_f32(storage &string, offset int, x &[]f32, x_off int) f32执行 q4 k dot f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intx &[]f32x_off intf32 — 该类型的值
q6_k_dot_f32pub fn q6_k_dot_f32(storage &string, offset int, x &[]f32, x_off int) f32执行 q6 k dot f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intx &[]f32x_off intf32 — 该类型的值
dot_q5_0_row_f32pub fn dot_q5_0_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32执行 dot q5 0 row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intx &[]f32x_off intn_blocks intf32 — 该类型的值
dot_q8_0_row_f32pub fn dot_q8_0_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32执行 dot q8 0 row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intx &[]f32x_off intn_blocks intf32 — 该类型的值
dot_q4_k_row_f32pub fn dot_q4_k_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32执行 dot q4 k row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intx &[]f32x_off intn_blocks intf32 — 该类型的值
dot_q6_k_row_f32pub fn dot_q6_k_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32执行 dot q6 k row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intx &[]f32x_off intn_blocks intf32 — 该类型的值
quantize_q5_0_rowpub fn quantize_q5_0_row(x &[]f32, out $&[]u8, n int)执行 quantize q5 0 row 操作。
x &[]f32out $&[]u8n int不返回值。
dequant_f16_to_f32pub fn dequant_f16_to_f32(src &string, off int, dst $&[]f32, dst_off int, n int) int执行 dequant f16 to f32 操作。失败时抛出错误,调用方需处理或继续传播。
src &stringoff intdst $&[]f32dst_off intn intint — 该类型的值
dequant_bf16_to_f32pub fn dequant_bf16_to_f32(src &string, off int, dst $&[]f32, dst_off int, n int) int执行 dequant bf16 to f32 操作。失败时抛出错误,调用方需处理或继续传播。
src &stringoff intdst $&[]f32dst_off intn intint — 该类型的值
quantize_q8_k_rowpub fn quantize_q8_k_row(x &[]f32, x_off int, qs $&[]i8, d_out $&[]f32, bsums $&[]int, n_blocks int) int执行 quantize q8 k row 操作。失败时抛出错误,调用方需处理或继续传播。
x &[]f32x_off intqs $&[]i8d_out $&[]f32bsums $&[]intn_blocks intint — 该类型的值
dot_q4_k_q8_k_row_f32pub 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执行 dot q4 k q8 k row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intq8_qs &[]i8q8_d &[]f32q8_bsums &[]intn_blocks intf32 — 该类型的值
dot_q5_k_bytes_f32pub fn dot_q5_k_bytes_f32(storage &string, offset int, x &[]f32, x_off int) f32执行 dot q5 k bytes f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intx &[]f32x_off intf32 — 该类型的值
dot_q5_k_row_f32pub fn dot_q5_k_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32执行 dot q5 k row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intx &[]f32x_off intn_blocks intf32 — 该类型的值
dot_q5_k_q8_k_row_f32pub 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执行 dot q5 k q8 k row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intq8_qs &[]i8q8_d &[]f32q8_bsums &[]intn_blocks intf32 — 该类型的值
dot_q6_k_q8_k_row_f32pub fn dot_q6_k_q8_k_row_f32(storage &string, row_off int, q8_qs &[]i8, q8_d &[]f32, n_blocks int) f32执行 dot q6 k q8 k row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intq8_qs &[]i8q8_d &[]f32n_blocks intf32 — 该类型的值
read_q4_1pub fn read_q4_1(storage &string, offset int) Q41Block读取q41。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intQ41Block — 该类型的值
(&Q41Block) append_f32pub fn (block &Q41Block) append_f32(out $&[]f32)&Q41Block 上的操作:追加f32。
block &Q41BlockQ41Block 实例;以只读借用传入,调用方仍持有实例。out $&[]f32不返回值。
(&Q41Block) dot_f32pub fn (block &Q41Block) dot_f32(x &[]f32, x_off int) f32&Q41Block 上的操作:执行 dot f32 操作。
block &Q41BlockQ41Block 实例;以只读借用传入,调用方仍持有实例。x &[]f32x_off intf32 — 该类型的值
dot_q4_1_row_f32pub fn dot_q4_1_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32执行 dot q4 1 row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intx &[]f32x_off intn_blocks intf32 — 该类型的值
read_q5_1pub fn read_q5_1(storage &string, offset int) Q51Block读取q51。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intQ51Block — 该类型的值
(&Q51Block) append_f32pub fn (block &Q51Block) append_f32(out $&[]f32)&Q51Block 上的操作:追加f32。
block &Q51BlockQ51Block 实例;以只读借用传入,调用方仍持有实例。out $&[]f32不返回值。
(&Q51Block) dot_f32pub fn (block &Q51Block) dot_f32(x &[]f32, x_off int) f32&Q51Block 上的操作:执行 dot f32 操作。
block &Q51BlockQ51Block 实例;以只读借用传入,调用方仍持有实例。x &[]f32x_off intf32 — 该类型的值
dot_q5_1_row_f32pub fn dot_q5_1_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32执行 dot q5 1 row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intx &[]f32x_off intn_blocks intf32 — 该类型的值
read_q2_kpub fn read_q2_k(storage &string, offset int) Q2KBlock执行 read q2 k 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intQ2KBlock — 该类型的值
(&Q2KBlock) append_f32pub fn (block &Q2KBlock) append_f32(out $&[]f32)&Q2KBlock 上的操作:追加f32。
block &Q2KBlockQ2KBlock 实例;以只读借用传入,调用方仍持有实例。out $&[]f32不返回值。
dot_q2_k_row_f32pub fn dot_q2_k_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32执行 dot q2 k row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intx &[]f32x_off intn_blocks intf32 — 该类型的值
dot_q2_k_q8_k_row_f32pub 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执行 dot q2 k q8 k row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intq8_qs &[]i8q8_d &[]f32q8_bsums &[]intn_blocks intf32 — 该类型的值
read_q3_kpub fn read_q3_k(storage &string, offset int) Q3KBlock执行 read q3 k 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringoffset intQ3KBlock — 该类型的值
(&Q3KBlock) append_f32pub fn (block &Q3KBlock) append_f32(out $&[]f32)&Q3KBlock 上的操作:追加f32。
block &Q3KBlockQ3KBlock 实例;以只读借用传入,调用方仍持有实例。out $&[]f32不返回值。
dot_q3_k_row_f32pub fn dot_q3_k_row_f32(storage &string, row_off int, x &[]f32, x_off int, n_blocks int) f32执行 dot q3 k row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intx &[]f32x_off intn_blocks intf32 — 该类型的值
dot_q3_k_q8_k_row_f32pub fn dot_q3_k_q8_k_row_f32(storage &string, row_off int, q8_qs &[]i8, q8_d &[]f32, n_blocks int) f32执行 dot q3 k q8 k row f32 操作。失败时抛出错误,调用方需处理或继续传播。
storage &stringrow_off intq8_qs &[]i8q8_d &[]f32n_blocks intf32 — 该类型的值
struct TensorViewpub struct TensorView {
}TensorView 上下文或状态结构体。
此类型没有公开字段。
strided_viewpub fn strided_view(kind DType, shape &[]int, strides &[]int, byte_offset int, storage_bytes int) TensorView执行 strided view 操作。失败时抛出错误,调用方需处理或继续传播。
kind DTypeshape &[]intstrides &[]intbyte_offset intstorage_bytes intTensorView — 该类型的值
contiguous_viewpub fn contiguous_view(kind DType, shape &[]int, byte_offset int, storage_bytes int) TensorView执行 contiguous view 操作。失败时抛出错误,调用方需处理或继续传播。
kind DTypeshape &[]intbyte_offset intstorage_bytes intTensorView — 该类型的值
(&TensorView) dtypepub fn (v &TensorView) dtype() DType在 &TensorView 上执行 dtype 操作。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。DType — 该类型的值
(&TensorView) rankpub fn (v &TensorView) rank() int在 &TensorView 上执行 rank 操作。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。int — 该类型的值
(&TensorView) element_countpub fn (v &TensorView) element_count() int&TensorView 上的操作:执行 element count 操作。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。int — 该类型的值
(&TensorView) storage_startpub fn (v &TensorView) storage_start() int&TensorView 上的操作:执行 storage start 操作。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。int — 该类型的值
(&TensorView) storage_endpub fn (v &TensorView) storage_end() int&TensorView 上的操作:执行 storage end 操作。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。int — 该类型的值
(&TensorView) is_contiguouspub fn (v &TensorView) is_contiguous() bool&TensorView 上的操作:判断是否 contiguous。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。bool — 是否成立
(&TensorView) dimensionpub fn (v &TensorView) dimension(axis int) int在 &TensorView 上执行 dimension 操作。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。axis intint — 该类型的值
(&TensorView) stridepub fn (v &TensorView) stride(axis int) int在 &TensorView 上执行 stride 操作。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。axis intint — 该类型的值
(&TensorView) transposepub fn (v &TensorView) transpose(a int, b int) TensorView在 &TensorView 上执行 transpose 操作。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。a intb intTensorView — 该类型的值
(&TensorView) slicepub fn (v &TensorView) slice(axis int, first int, stop int, step int) TensorView&TensorView 上的操作:切片。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。axis intfirst intstop intstep intTensorView — 该类型的值
(&TensorView) reshapepub fn (v &TensorView) reshape(new_shape &[]int) TensorView在 &TensorView 上执行 reshape 操作。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。new_shape &[]intTensorView — 该类型的值
(&TensorView) permutepub fn (v &TensorView) permute(axes &[]int) TensorView在 &TensorView 上执行 permute 操作。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。axes &[]intTensorView — 该类型的值
(&TensorView) byte_offsetpub fn (v &TensorView) byte_offset(indices &[]int) int&TensorView 上的操作:执行 byte offset 操作。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。indices &[]intint — 该类型的值
(&TensorView) read_f32pub fn (v &TensorView) read_f32(storage &string, indices &[]int) f32&TensorView 上的操作:读取f32。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。storage &stringindices &[]intf32 — 该类型的值
(&TensorView) read_f32_linearpub fn (v &TensorView) read_f32_linear(storage &string, linear int) f32&TensorView 上的操作:执行 read f32 linear 操作。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。storage &stringlinear intf32 — 该类型的值
(&TensorView) append_f32pub fn (v &TensorView) append_f32(storage &string, out $&[]f32) int&TensorView 上的操作:追加f32。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。storage &stringout $&[]f32int — 该类型的值
(&TensorView) copy_f32pub fn (v &TensorView) copy_f32(storage &string, first int, count int, out $&[]f32, output_offset int) int&TensorView 上的操作:拷贝f32。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。storage &stringfirst intcount intout $&[]f32output_offset intint — 该类型的值
(&TensorView) read_f32_bytespub fn (v &TensorView) read_f32_bytes(storage &[]u8, indices &[]int) f32&TensorView 上的操作:读取f32字节。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。storage &[]u8indices &[]intf32 — 该类型的值
(&TensorView) write_f32_bytespub fn (v &TensorView) write_f32_bytes(storage $&[]u8, indices &[]int, value f32) int&TensorView 上的操作:写入f32字节。失败时抛出错误,调用方需处理或继续传播。
v &TensorViewTensorView 实例;以只读借用传入,调用方仍持有实例。storage $&[]u8indices &[]intvalue f32int — 该类型的值