- ❌
pub zeros(rows: i32, cols: i32) tensor { ... } - ✅
pub zeros(rows: i32, cols: i32) mat { ... }
- ❌
result = mat_mul(input, weight) - ✅
result = input.mul(weight)
- ❌
mat_set(t, i, j, val) - ✅
t.set(i, j, val)
- ✅
rows = mat_rows(t)
- ❌
cache.current_len += seq_len - ✅
cache.current_len = cache.current_len + seq_len
- ❌
if idx >= 0 and idx < e.num_embeddings { ... } - ✅ Use intermediate variable:
valid = idx < e.num_embeddings if valid { ... }
- The error "field access / method call on complex expressions not yet supported" means you need simpler expressions
- ❌
(l: Linear) forward(input: mat) mat { ... } - ✅
linear_forward(l: Linear, input: mat) mat { ... }
use tukllm→ looks forstdlib/tukllm.t- DON'T use
use tukllm.core.config- doesn't work
- Both create conflict in build.zig install step
-- Creating matrix
m = mat(3, 4)
m.set(i, j, val)
val = m.get(i, j)
-- Operations
result = a.mul(b) -- matrix multiply
result = a.add(b) -- matrix add
result = a.scale(2.0) -- scalar multiply
-- Info
rows = mat_rows(m)
cols = mat_cols(m)
sum = mat_sum(m)
mean = mat_mean(m)
-- Imports
use mathlib
use tukllm