Versions in this module Expand all Collapse all v1 v1.3.1 Jul 21, 2026 v1.3.0 Jul 20, 2026 Changes in this version + func AddCausalMaskExtendIn(a *tensor.Tensor, cacheLen int, neg float32) + func AnyStopInTopK(logits *tensor.Tensor, b int, stopIDs map[int]bool, k int) bool + func SampleTopKLastChat(logits *tensor.Tensor, b int, temperature float32, k int, stopIDs map[int]bool, ...) int + type AllocProgress struct + func NewAllocProgress(u ui.UI, totalBytes int64) *AllocProgress + func (p *AllocProgress) Done() + func (p *AllocProgress) ReportAlloc(t *tensor.Tensor) + type CopyProgress struct + func NewCopyProgress(u ui.UI, totalBytes int64) *CopyProgress + func (p *CopyProgress) Done() + func (p *CopyProgress) ReportTensor(t *tensor.Tensor) type KVCacheBlock + func (block *KVCacheBlock) GetPrefix(ct *tensor.Tensor, length int) *tensor.Tensor + func (block *KVCacheBlock) SetRange(ct *tensor.Tensor, value *tensor.Tensor) type SafeTensors + func LoadSafeTensorsFromDir(dir string, u ui.UI) (*SafeTensors, error) v1.2.0 Jun 29, 2026 Changes in this version + func AddCausalMaskIn(a *tensor.Tensor, neg float32) + func ArgMaxLastToken(logits *tensor.Tensor, b int) int + func CopyHFLinear(dst *neural.Linear, src *tensor.Tensor) + func CopyHFWeight(dst *tensor.Tensor, src *tensor.Tensor) + func CopyTensor(dst, src *tensor.Tensor) + func CopyTransposed(dst *tensor.Tensor, src *tensor.Tensor) + func EnsureFile(remote, local string, size int64, u ui.UI) + func LoadHFLinear(l *neural.Linear, sd *SafeTensors, keyW, keyB string) error + func LoadLinearDirect(l *neural.Linear, sd *SafeTensors, keyW, keyB string) error + func LoadTensor(dst *tensor.Tensor, sd *SafeTensors, key string) error + func PackQKVLastDimIn(dst, dQ, dK, dV *tensor.Tensor) + func SampleTopKLast(logits *tensor.Tensor, b int, temperature float32, k int, rng *rand.Rand) int + func SoftmaxBackward(att, dAtt *tensor.Tensor) *tensor.Tensor + func ZeroCausalUpperTriangleIn(S *tensor.Tensor) + type Attention struct + CAttn *neural.Linear + CProj *neural.Linear + Causal bool + D int + HeadDim int + Heads int + func NewAttention(d, heads int, causal bool) *Attention + func (a *Attention) Forward(x *tensor.Tensor, tape neural.Tape) (*tensor.Tensor, neural.Tape) + func (a *Attention) ForwardNext(cache *KVCacheBlock, x *tensor.Tensor) *tensor.Tensor + func (a *Attention) Load(file io.Reader) error + func (a *Attention) Save(file io.Writer) error + type KVCache struct + Blocks []*KVCacheBlock + Len int + func NewKVCache(embeddingSize, contextSize, heads, layers, batches int) *KVCache + func NewKVCacheFromEmbedding(embeddingSize, contextSize, heads, layers, batches int) *KVCache + func NewKVCacheWithHeadDim(heads, headDim, contextSize, layers, batches int) *KVCache + type KVCacheBlock struct + K *tensor.Tensor + V *tensor.Tensor + func (block *KVCacheBlock) Get(ct *tensor.Tensor) *tensor.Tensor + func (block *KVCacheBlock) Set(ct *tensor.Tensor, value *tensor.Tensor) + type PositionEmbeddings struct + Emb *neural.Embeddings + func NewPositionEmbeddings(count, size int) *PositionEmbeddings + func (pos *PositionEmbeddings) Forward(B, T int, tape neural.Tape) (*tensor.Tensor, neural.Tape) + func (pos *PositionEmbeddings) ForwardAt(B, index int) *tensor.Tensor + func (pos *PositionEmbeddings) Load(file io.Reader) error + func (pos *PositionEmbeddings) Save(file io.Writer) error + type SafeTensors struct + func LoadSafeTensors(path string, u ui.UI) (*SafeTensors, error) + func (s *SafeTensors) Free() + func (s *SafeTensors) Get(key string) (*tensor.Tensor, error) + type Top struct + ID int + Logit float32 + func TopKLastToken(logits *tensor.Tensor, b int, k int) []Top