Versions in this module Expand all Collapse all v0 v0.0.1 Apr 11, 2026 Changes in this version + const DimBoundDynamic + const DimBoundStatic + const DirectoryEntrySize + const EntryKindFunction + const EntryKindKernel + const EntryKindPipeline + const FileFlagHasSignature + const HeaderSize + const OptimizerAdamW + const OptimizerLAMB + const OptimizerSGD + const PlanStepHostOp + const PlanStepKernel + const ResidencyDeviceResident + const ResidencyHostPinned + const ResidencyHostShared + const ResidencyLazyStaged + const SectionFlagAligned + const SectionFlagCompressed + const SectionFlagExternal + const SectionFlagRequired + const SectionFlagSchemaless + const SectionFlagSkippable + const SigAlgorithmEd25519 + const SigAlgorithmNone + const StorageClassActivation + const StorageClassIO + const StorageClassWorkspace + const TypeKindCandidatePack + const TypeKindKVCache + const TypeKindTensor + var Magic = [4]byte + var TagBUFF = [4]byte + var TagDIMS = [4]byte + var TagENTR = [4]byte + var TagENUM = [4]byte + var TagHEAD = [4]byte + var TagKRNL = [4]byte + var TagMEMP = [4]byte + var TagOPTM = [4]byte + var TagPARM = [4]byte + var TagPLAN = [4]byte + var TagSCHM = [4]byte + var TagSGNM = [4]byte + var TagSTRG = [4]byte + var TagTNSR = [4]byte + var TagTYPE = [4]byte + var V1_0 = Version + func Float64bits(f float64) uint64 + func Float64frombits(b uint64) float64 + func IsCustomTag(tag [4]byte) bool + func IsForbidden(p Profile, tag [4]byte) bool + func IsRequired(p Profile, tag [4]byte) bool + func ReadUint16LE(b []byte) (uint16, error) + func ReadUint32LE(b []byte) (uint32, error) + func ReadUint64LE(b []byte) (uint64, error) + func ReadUvarint(b []byte) (uint64, int, error) + func ReadVarint(b []byte) (int64, int, error) + func ValidateDimDepth(d Dimension) error + func WriteDimension(w io.Writer, d Dimension) error + func WriteDimensionWithIndex(w io.Writer, d Dimension, stringIndex map[string]uint32) error + func WriteDirectory(w io.Writer, entries []DirectoryEntry) error + func WriteShape(w io.Writer, shape []Dimension) error + func WriteToBytes(profile Profile, version Version, sections []SectionInput, ...) ([]byte, error) + func WriteUint16LE(w io.Writer, v uint16) error + func WriteUint32LE(w io.Writer, v uint32) error + func WriteUint64LE(w io.Writer, v uint64) error + func WriteUvarint(w io.Writer, v uint64) error + func WriteVarint(w io.Writer, v int64) error + type Bool bool + type BuffBuilder struct + func NewBuffBuilder() *BuffBuilder + func (b *BuffBuilder) Add(d BuffDecl) + func (b *BuffBuilder) Write(w io.Writer) error + type BuffDecl struct + NameIdx uint32 + StorageClass uint8 + TypeRef Ref + type BuffSection struct + Decls []BuffDecl + func ReadBuffSection(data []byte) (BuffSection, error) + type Bytes []byte + type CandidatePackType struct + Rank int + type Checkpoint struct + func NewCheckpoint(path string, opts CheckpointOptions) (*Checkpoint, error) + func (c *Checkpoint) Close() error + func (c *Checkpoint) Generation() uint64 + func (c *Checkpoint) Save() error + func (c *Checkpoint) SetSection(s SectionInput) + type CheckpointOptions struct + SkipRequirementCheck bool + SlackBytes uint64 + type CustomChunk struct + Body []byte + Tag [4]byte + type DType uint8 + const DTypeF16 + const DTypeF32 + const DTypeF64 + const DTypeI16 + const DTypeI32 + const DTypeI64 + const DTypeI8 + const DTypeInvalid + const DTypeQ4 + const DTypeQ8 + const DTypeU16 + const DTypeU32 + const DTypeU64 + const DTypeU8 + func (d DType) ElementSize() int + type Digest [32]byte + func HashBytes(data []byte) Digest + func SealedContentHash(version Version, profile Profile, fileFlags uint8, entries []DirectoryEntry) Digest + type DimDecl struct + Bound uint8 + NameIdx uint32 + Value int64 + type DimExpr struct + Left Dimension + Op DimOp + Right Dimension + func NewDimExpr(op DimOp, left, right Dimension) *DimExpr + func (e *DimExpr) Depth() int + func (e *DimExpr) Equal(other *DimExpr) bool + func (e *DimExpr) String() string + type DimKind uint8 + const DimKindExpr + const DimKindLiteral + const DimKindSymbol + type DimOp uint8 + const DimOpAdd + const DimOpDiv + const DimOpMul + const DimOpSub + type Dimension struct + Expr *DimExpr + Kind DimKind + Symbol string + SymbolIdx uint32 + Value int64 + func DimLiteral(v int64) Dimension + func DimSymbol(name string) Dimension + func NormalizeDim(d Dimension, stringIndex map[string]uint32) Dimension + func ReadDimension(b []byte) (Dimension, int, error) + func ReadShape(b []byte) ([]Dimension, int, error) + func (d Dimension) String() string + type DimsBuilder struct + func NewDimsBuilder() *DimsBuilder + func (b *DimsBuilder) Add(d DimDecl) + func (b *DimsBuilder) Decls() []DimDecl + func (b *DimsBuilder) Write(w io.Writer) error + type DimsSection struct + Decls []DimDecl + func ReadDimsSection(data []byte) (DimsSection, error) + type DirectoryEntry struct + Digest Digest + Flags uint16 + Offset uint64 + SchemaVersion uint16 + Size uint64 + Tag [4]byte + func CanonicalSectionOrder(entries []DirectoryEntry, profile Profile) []DirectoryEntry + func ReadDirectory(b []byte, n uint32) ([]DirectoryEntry, error) + func ReadDirectoryEntry(b []byte) (DirectoryEntry, error) + func (e DirectoryEntry) Write(w io.Writer) error + type EntrBuilder struct + func NewEntrBuilder() *EntrBuilder + func (b *EntrBuilder) Add(e EntryPoint) + func (b *EntrBuilder) Write(w io.Writer) error + type EntrSection struct + Entries []EntryPoint + func ReadEntrSection(data []byte) (EntrSection, error) + type EntryPoint struct + Inputs []ValueBinding + Kind uint8 + NameIdx uint32 + Outputs []ValueBinding + type EnumDecl struct + Name string + Values []string + func (e EnumDecl) HasValue(v string) bool + type EnumSection struct + Enums []EnumSectionEntry + func ReadEnumSection(b []byte) (EnumSection, error) + func (e EnumSection) Write(w io.Writer) error + type EnumSectionEntry struct + Name uint32 + Values []uint32 + type EnumValue struct + Type string + Value string + type FileHeader struct + Flags uint8 + MinReaderMinor uint8 + Profile Profile + SectionCount uint32 + TotalFileSize uint64 + Version Version + func ReadHeader(b []byte) (FileHeader, error) + func (h FileHeader) Write(w io.Writer) error + type Float16 uint16 + type Float32 float32 + type Float64 float64 + type Hasher struct + func NewHasher() *Hasher + func (h *Hasher) Reset() + func (h *Hasher) Sum() Digest + func (h *Hasher) Write(p []byte) (int, error) + type HeadMetadataEntry struct + Bool bool + F64 float64 + I64 int64 + Key uint32 + Kind HeadValueKind + StringIdx uint32 + type HeadSection struct + Backends []uint16 + Capabilities []uint32 + CreatedUnixMs int64 + Description uint32 + Generation uint64 + Metadata []HeadMetadataEntry + Name uint32 + func ReadHeadSection(b []byte) (HeadSection, error) + func (h HeadSection) DigestBody(profile Profile) []byte + func (h HeadSection) Write(w io.Writer) error + type HeadValueKind uint8 + const HeadValueBool + const HeadValueF64 + const HeadValueI64 + const HeadValueNull + const HeadValueString + type Int16 int16 + type Int32 int32 + type Int64 int64 + type Int8 int8 + type KVCacheType struct + HeadDim int + Heads int + Layers int + type KernelDecl struct + Body []byte + NameIdx uint32 + type KrnlBuilder struct + func NewKrnlBuilder() *KrnlBuilder + func (b *KrnlBuilder) Add(k KernelDecl) + func (b *KrnlBuilder) Write(w io.Writer) error + type KrnlSection struct + Decls []KernelDecl + func ReadKrnlSection(data []byte) (KrnlSection, error) + type Layout uint8 + const LayoutColMajor + const LayoutRowMajor + type List []any + type Map map[string]any + type MempBuilder struct + func NewMempBuilder() *MempBuilder + func (b *MempBuilder) Add(e MempEntry) + func (b *MempBuilder) Write(w io.Writer) error + type MempEntry struct + AccessCount uint32 + ParamRef Ref + Residency uint8 + type MempSection struct + Entries []MempEntry + func ReadMempSection(data []byte) (MempSection, error) + type OptmBuilder struct + func NewOptmBuilder(kind uint8) *OptmBuilder + func (b *OptmBuilder) AddMomentTensor(ref Ref) + func (b *OptmBuilder) SetGeneration(gen uint64) + func (b *OptmBuilder) SetStep(step uint64) + func (b *OptmBuilder) Write(w io.Writer) error + type OptmSection struct + Generation uint64 + Kind uint8 + LRSchedule uint8 + LRStateBytes []byte + MomentTensors []Ref + Step uint64 + func ReadOptmSection(data []byte) (OptmSection, error) + type ParmBuilder struct + func NewParmBuilder() *ParmBuilder + func (b *ParmBuilder) Add(p ParmDecl) + func (b *ParmBuilder) Write(w io.Writer) error + type ParmDecl struct + BindingIdx uint32 + NameIdx uint32 + Trainable bool + TypeRef Ref + type ParmSection struct + Decls []ParmDecl + func ReadParmSection(data []byte) (ParmSection, error) + type PlanBuilder struct + func NewPlanBuilder() *PlanBuilder + func (b *PlanBuilder) Add(s PlanStep) + func (b *PlanBuilder) Write(w io.Writer) error + type PlanSection struct + Steps []PlanStep + func ReadPlanSection(data []byte) (PlanSection, error) + type PlanStep struct + EntryRef Ref + Inputs []Ref + KernelRef Ref + Kind uint8 + NameIdx uint32 + Outputs []Ref + type PrimitiveKind uint8 + const KindBool + const KindBytes + const KindDim + const KindEnum + const KindFloat16 + const KindFloat32 + const KindFloat64 + const KindInt16 + const KindInt32 + const KindInt64 + const KindInt8 + const KindList + const KindMap + const KindNull + const KindRef + const KindString + const KindTensor + const KindUint16 + const KindUint32 + const KindUint64 + const KindUint8 + const KindValue + type Profile uint8 + const ProfileCheckpoint + const ProfileSealed + const ProfileWeightsOnly + type ReadOption func(*readerConfig) + func WithDigestVerification() ReadOption + type Reader struct + func ReadBytes(data []byte, opts ...ReadOption) (*Reader, error) + func ReadFile(path string, opts ...ReadOption) (*Reader, error) + func (r *Reader) DirectoryEntries() []DirectoryEntry + func (r *Reader) Profile() Profile + func (r *Reader) Section(tag [4]byte) ([]byte, bool) + func (r *Reader) SectionCount() uint32 + func (r *Reader) Version() Version + type Ref struct + Index uint32 + Tag [4]byte + func DecodeRef(b []byte) (Ref, error) + func (r Ref) Encode() []byte + type SchmSection struct + func ReadSchmSection(data []byte) (SchmSection, error) + func (s SchmSection) Write(w io.Writer) error + type SectionInput struct + Body []byte + DigestBody []byte + Flags uint16 + SchemaVersion uint16 + Tag [4]byte + type SgnmSection struct + Algorithm uint8 + KeyIDIdx uint32 + Signature []byte + func ReadSgnmSection(data []byte) (SgnmSection, error) + func (s SgnmSection) Write(w io.Writer) error + type String string + type StringTable struct + func NewStringTableBuilder() *StringTable + func ReadStringTable(b []byte) (*StringTable, error) + func (t *StringTable) At(idx uint32) string + func (t *StringTable) CanonicalizeLexicographic() map[uint32]uint32 + func (t *StringTable) Contains(s string) bool + func (t *StringTable) Intern(s string) uint32 + func (t *StringTable) Lookup(s string) (uint32, bool) + func (t *StringTable) Size() int + func (t *StringTable) Write(w io.Writer) error + type Tensor struct + DType DType + DataOffset uint64 + DataSize uint64 + Layout Layout + Name string + Shape []Dimension + type TensorEntry struct + BodyOffset uint64 + BodySize uint64 + DType DType + Data []byte + NameIdx uint32 + Shape []uint64 + type TensorType struct + DType DType + Shape []Dimension + type TnsrBuilder struct + func NewTnsrBuilder() *TnsrBuilder + func (b *TnsrBuilder) Add(e TensorEntry) + func (b *TnsrBuilder) Write(w io.Writer) error + type TnsrSection struct + Tensors []TensorEntry + func ReadTnsrSection(data []byte) (TnsrSection, error) + type TypeBuilder struct + func NewTypeBuilder() *TypeBuilder + func (b *TypeBuilder) AddCandidatePackType(nameIdx uint32, rank uint32) uint32 + func (b *TypeBuilder) AddKVCacheType(nameIdx uint32, layers, heads, headDim uint32) uint32 + func (b *TypeBuilder) AddTensorType(nameIdx uint32, dtype DType, shape []Dimension) uint32 + func (b *TypeBuilder) Decls() []TypeDecl + func (b *TypeBuilder) Write(w io.Writer) error + type TypeDecl struct + DType DType + HeadDim uint32 + Heads uint32 + Kind uint8 + Layers uint32 + NameIdx uint32 + Rank uint32 + Shape []Dimension + type TypeSection struct + Decls []TypeDecl + func ReadTypeSection(data []byte) (TypeSection, error) + type Uint16 uint16 + type Uint32 uint32 + type Uint64 uint64 + type Uint8 uint8 + type Value interface + type ValueBinding struct + NameIdx uint32 + TypeRef Ref + type ValueKind uint8 + const ValueKindCandidatePack + const ValueKindInvalid + const ValueKindKVCache + const ValueKindTensor + type ValueType struct + CandidatePack *CandidatePackType + KVCache *KVCacheType + Kind ValueKind + Tensor *TensorType + func ValueOfCandidatePack(c CandidatePackType) ValueType + func ValueOfKVCache(k KVCacheType) ValueType + func ValueOfTensor(t TensorType) ValueType + type Version struct + Major uint8 + Minor uint8 + func (v Version) Uint16() uint16 + type Writer struct + func NewWriter(out io.Writer, profile Profile, version Version, opts ...WriterOption) *Writer + func (w *Writer) AddSection(s SectionInput) + func (w *Writer) ContentHash() Digest + func (w *Writer) Finish() error + func (w *Writer) SetFileFlag(flag uint8) + type WriterOption func(*Writer) + func WithSkipRequirementCheck() WriterOption v0.0.0 Apr 11, 2026