Documentation
¶
Index ¶
- Variables
- type Attribute
- func (*Attribute) Descriptor() ([]byte, []int)deprecated
- func (x *Attribute) GetB() bool
- func (x *Attribute) GetF() float32
- func (x *Attribute) GetFloats() *Floats
- func (x *Attribute) GetI() int64
- func (x *Attribute) GetInts() *Ints
- func (x *Attribute) GetS() string
- func (x *Attribute) GetStrings() *Strings
- func (x *Attribute) GetValue() isAttribute_Value
- func (*Attribute) ProtoMessage()
- func (x *Attribute) ProtoReflect() protoreflect.Message
- func (x *Attribute) Reset()
- func (x *Attribute) String() string
- type Attribute_B
- type Attribute_F
- type Attribute_Floats
- type Attribute_I
- type Attribute_Ints
- type Attribute_S
- type Attribute_Strings
- type Floats
- type Graph
- func (*Graph) Descriptor() ([]byte, []int)deprecated
- func (x *Graph) GetInputs() []*ValueInfo
- func (x *Graph) GetNodes() []*Node
- func (x *Graph) GetOutputs() []*ValueInfo
- func (x *Graph) GetParameters() map[string]*Tensor
- func (*Graph) ProtoMessage()
- func (x *Graph) ProtoReflect() protoreflect.Message
- func (x *Graph) Reset()
- func (x *Graph) String() string
- type Ints
- type Metadata
- func (*Metadata) Descriptor() ([]byte, []int)deprecated
- func (x *Metadata) GetOpsetVersion() int64
- func (x *Metadata) GetProducerName() string
- func (x *Metadata) GetProducerVersion() string
- func (*Metadata) ProtoMessage()
- func (x *Metadata) ProtoReflect() protoreflect.Message
- func (x *Metadata) Reset()
- func (x *Metadata) String() string
- type Model
- func (*Model) Descriptor() ([]byte, []int)deprecated
- func (x *Model) GetGraph() *Graph
- func (x *Model) GetMetadata() *Metadata
- func (x *Model) GetZmfVersion() string
- func (*Model) ProtoMessage()
- func (x *Model) ProtoReflect() protoreflect.Message
- func (x *Model) Reset()
- func (x *Model) String() string
- type Node
- func (*Node) Descriptor() ([]byte, []int)deprecated
- func (x *Node) GetAttributes() map[string]*Attribute
- func (x *Node) GetAxis() int64
- func (x *Node) GetEpsilon() float32
- func (x *Node) GetInputs() []string
- func (x *Node) GetName() string
- func (x *Node) GetOpType() string
- func (x *Node) GetOutputs() []string
- func (x *Node) GetPerm() []int64
- func (*Node) ProtoMessage()
- func (x *Node) ProtoReflect() protoreflect.Message
- func (x *Node) Reset()
- func (x *Node) String() string
- type Quantization
- func (*Quantization) Descriptor() ([]byte, []int)deprecated
- func (x *Quantization) GetQMax() int64
- func (x *Quantization) GetQMin() int64
- func (x *Quantization) GetScale() float32
- func (x *Quantization) GetZeroPoint() int64
- func (*Quantization) ProtoMessage()
- func (x *Quantization) ProtoReflect() protoreflect.Message
- func (x *Quantization) Reset()
- func (x *Quantization) String() string
- type Strings
- type Tensor
- func (*Tensor) Descriptor() ([]byte, []int)deprecated
- func (x *Tensor) GetData() []byte
- func (x *Tensor) GetDtype() Tensor_DataType
- func (x *Tensor) GetQuant() *Quantization
- func (x *Tensor) GetShape() []int64
- func (*Tensor) ProtoMessage()
- func (x *Tensor) ProtoReflect() protoreflect.Message
- func (x *Tensor) Reset()
- func (x *Tensor) String() string
- type Tensor_DataType
- func (Tensor_DataType) Descriptor() protoreflect.EnumDescriptor
- func (x Tensor_DataType) Enum() *Tensor_DataType
- func (Tensor_DataType) EnumDescriptor() ([]byte, []int)deprecated
- func (x Tensor_DataType) Number() protoreflect.EnumNumber
- func (x Tensor_DataType) String() string
- func (Tensor_DataType) Type() protoreflect.EnumType
- type ValueInfo
- func (*ValueInfo) Descriptor() ([]byte, []int)deprecated
- func (x *ValueInfo) GetDtype() Tensor_DataType
- func (x *ValueInfo) GetName() string
- func (x *ValueInfo) GetShape() []int64
- func (*ValueInfo) ProtoMessage()
- func (x *ValueInfo) ProtoReflect() protoreflect.Message
- func (x *ValueInfo) Reset()
- func (x *ValueInfo) String() string
Constants ¶
This section is empty.
Variables ¶
var ( Tensor_DataType_name = map[int32]string{ 0: "BFLOAT16", 1: "BOOL", 2: "FLOAT16", 3: "FLOAT32", 4: "FLOAT64", 5: "FLOAT8", 6: "INT16", 7: "INT32", 8: "INT64", 9: "INT8", 10: "STRING", 11: "UINT32", 12: "UINT64", 13: "UINT8", } Tensor_DataType_value = map[string]int32{ "BFLOAT16": 0, "BOOL": 1, "FLOAT16": 2, "FLOAT32": 3, "FLOAT64": 4, "FLOAT8": 5, "INT16": 6, "INT32": 7, "INT64": 8, "INT8": 9, "STRING": 10, "UINT32": 11, "UINT64": 12, "UINT8": 13, } )
Enum value maps for Tensor_DataType.
var File_zerfoo_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct {
// Types that are valid to be assigned to Value:
//
// *Attribute_F
// *Attribute_I
// *Attribute_S
// *Attribute_Floats
// *Attribute_Ints
// *Attribute_Strings
// *Attribute_B
Value isAttribute_Value `protobuf_oneof:"value"`
// contains filtered or unexported fields
}
Attribute represents a named, non-tensor parameter for a node.
func (*Attribute) Descriptor
deprecated
func (*Attribute) GetStrings ¶
func (*Attribute) ProtoMessage ¶
func (*Attribute) ProtoMessage()
func (*Attribute) ProtoReflect ¶
func (x *Attribute) ProtoReflect() protoreflect.Message
type Attribute_B ¶ added in v0.2.0
type Attribute_B struct {
B bool `protobuf:"varint,7,opt,name=b,proto3,oneof"` // Added boolean support
}
type Attribute_F ¶
type Attribute_F struct {
F float32 `protobuf:"fixed32,1,opt,name=f,proto3,oneof"`
}
type Attribute_Floats ¶
type Attribute_Floats struct {
Floats *Floats `protobuf:"bytes,4,opt,name=floats,proto3,oneof"`
}
type Attribute_I ¶
type Attribute_I struct {
I int64 `protobuf:"varint,2,opt,name=i,proto3,oneof"`
}
type Attribute_Ints ¶
type Attribute_Ints struct {
Ints *Ints `protobuf:"bytes,5,opt,name=ints,proto3,oneof"`
}
type Attribute_S ¶
type Attribute_S struct {
S string `protobuf:"bytes,3,opt,name=s,proto3,oneof"`
}
type Attribute_Strings ¶
type Attribute_Strings struct {
Strings *Strings `protobuf:"bytes,6,opt,name=strings,proto3,oneof"`
}
type Floats ¶
type Floats struct {
Val []float32 `protobuf:"fixed32,1,rep,packed,name=val,proto3" json:"val,omitempty"`
// contains filtered or unexported fields
}
Floats is a wrapper for repeated float values in attributes.
func (*Floats) Descriptor
deprecated
func (*Floats) ProtoMessage ¶
func (*Floats) ProtoMessage()
func (*Floats) ProtoReflect ¶
func (x *Floats) ProtoReflect() protoreflect.Message
type Graph ¶
type Graph struct {
// A map of all trainable parameters (weights, biases) in the model.
// The key is a unique name for the parameter, e.g., "layers.0.attention.wq.weight".
Parameters map[string]*Tensor `` /* 147-byte string literal not displayed */
// A list of all nodes (layers or operations) in the graph.
// For sequential models, this list should be in execution order.
Nodes []*Node `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes,omitempty"`
// A list describing the input tensors to the graph.
Inputs []*ValueInfo `protobuf:"bytes,3,rep,name=inputs,proto3" json:"inputs,omitempty"`
// A list describing the output tensors of the graph.
Outputs []*ValueInfo `protobuf:"bytes,4,rep,name=outputs,proto3" json:"outputs,omitempty"`
// contains filtered or unexported fields
}
Graph represents the computation graph of the model.
func (*Graph) Descriptor
deprecated
func (*Graph) GetOutputs ¶
func (*Graph) GetParameters ¶
func (*Graph) ProtoMessage ¶
func (*Graph) ProtoMessage()
func (*Graph) ProtoReflect ¶
func (x *Graph) ProtoReflect() protoreflect.Message
type Ints ¶
type Ints struct {
Val []int64 `protobuf:"varint,1,rep,packed,name=val,proto3" json:"val,omitempty"`
// contains filtered or unexported fields
}
Ints is a wrapper for repeated int64 values in attributes.
func (*Ints) Descriptor
deprecated
func (*Ints) ProtoMessage ¶
func (*Ints) ProtoMessage()
func (*Ints) ProtoReflect ¶
func (x *Ints) ProtoReflect() protoreflect.Message
type Metadata ¶
type Metadata struct {
// The name of the tool or framework that produced this model.
ProducerName string `protobuf:"bytes,1,opt,name=producer_name,json=producerName,proto3" json:"producer_name,omitempty"`
// The version of the producer.
ProducerVersion string `protobuf:"bytes,2,opt,name=producer_version,json=producerVersion,proto3" json:"producer_version,omitempty"`
// The version of the ZMF operator set this model conforms to.
OpsetVersion int64 `protobuf:"varint,3,opt,name=opset_version,json=opsetVersion,proto3" json:"opset_version,omitempty"`
// contains filtered or unexported fields
}
Metadata stores information about the model's origin and versioning.
func (*Metadata) Descriptor
deprecated
func (*Metadata) GetOpsetVersion ¶
func (*Metadata) GetProducerName ¶
func (*Metadata) GetProducerVersion ¶
func (*Metadata) ProtoMessage ¶
func (*Metadata) ProtoMessage()
func (*Metadata) ProtoReflect ¶
func (x *Metadata) ProtoReflect() protoreflect.Message
type Model ¶
type Model struct {
// The computation graph defining the model's architecture.
Graph *Graph `protobuf:"bytes,1,opt,name=graph,proto3" json:"graph,omitempty"`
// Metadata about the model, such as its producer.
Metadata *Metadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"`
// Version of the ZMF format itself.
ZmfVersion string `protobuf:"bytes,3,opt,name=zmf_version,json=zmfVersion,proto3" json:"zmf_version,omitempty"`
// contains filtered or unexported fields
}
Model is the top-level container for a serialized Zerfoo model.
func (*Model) Descriptor
deprecated
func (*Model) GetMetadata ¶
func (*Model) GetZmfVersion ¶ added in v0.2.0
func (*Model) ProtoMessage ¶
func (*Model) ProtoMessage()
func (*Model) ProtoReflect ¶
func (x *Model) ProtoReflect() protoreflect.Message
type Node ¶
type Node struct {
// A unique name for this node, e.g., "transformer_block_0".
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// The type of operation this node performs, e.g., "RMSNorm", "GlobalAttention".
// This must map to a registered constructor in the importer.
OpType string `protobuf:"bytes,2,opt,name=op_type,json=opType,proto3" json:"op_type,omitempty"`
// A list of names of the tensors that are inputs to this node.
// These can be names of parameters or outputs of other nodes.
Inputs []string `protobuf:"bytes,3,rep,name=inputs,proto3" json:"inputs,omitempty"`
// A list of names for the output tensors of this node.
Outputs []string `protobuf:"bytes,4,rep,name=outputs,proto3" json:"outputs,omitempty"`
// A map of attributes for this node, for values that are not tensors.
// e.g., "epsilon" for RMSNorm, "hidden_dim" for FFN.
Attributes map[string]*Attribute `` /* 147-byte string literal not displayed */
// Common attributes for explicitness
Epsilon *float32 `protobuf:"fixed32,6,opt,name=epsilon,proto3,oneof" json:"epsilon,omitempty"` // Used in normalization layers
Perm []int64 `protobuf:"varint,7,rep,packed,name=perm,proto3" json:"perm,omitempty"` // Used in transpose operations
Axis *int64 `protobuf:"varint,8,opt,name=axis,proto3,oneof" json:"axis,omitempty"` // Used in reduction operations
// contains filtered or unexported fields
}
Node represents a single layer or operation in the computation graph.
func (*Node) Descriptor
deprecated
func (*Node) GetAttributes ¶
func (*Node) GetEpsilon ¶ added in v0.2.0
func (*Node) GetOutputs ¶
func (*Node) ProtoMessage ¶
func (*Node) ProtoMessage()
func (*Node) ProtoReflect ¶
func (x *Node) ProtoReflect() protoreflect.Message
type Quantization ¶ added in v0.2.0
type Quantization struct {
// The scale factor for quantization.
Scale float32 `protobuf:"fixed32,1,opt,name=scale,proto3" json:"scale,omitempty"`
// The zero point for quantization.
ZeroPoint int64 `protobuf:"varint,2,opt,name=zero_point,json=zeroPoint,proto3" json:"zero_point,omitempty"`
// The minimum value of the quantized range.
QMin *int64 `protobuf:"varint,3,opt,name=q_min,json=qMin,proto3,oneof" json:"q_min,omitempty"`
// The maximum value of the quantized range.
QMax *int64 `protobuf:"varint,4,opt,name=q_max,json=qMax,proto3,oneof" json:"q_max,omitempty"`
// contains filtered or unexported fields
}
Quantization describes the parameters for affine quantization.
func (*Quantization) Descriptor
deprecated
added in
v0.2.0
func (*Quantization) Descriptor() ([]byte, []int)
Deprecated: Use Quantization.ProtoReflect.Descriptor instead.
func (*Quantization) GetQMax ¶ added in v0.2.0
func (x *Quantization) GetQMax() int64
func (*Quantization) GetQMin ¶ added in v0.2.0
func (x *Quantization) GetQMin() int64
func (*Quantization) GetScale ¶ added in v0.2.0
func (x *Quantization) GetScale() float32
func (*Quantization) GetZeroPoint ¶ added in v0.2.0
func (x *Quantization) GetZeroPoint() int64
func (*Quantization) ProtoMessage ¶ added in v0.2.0
func (*Quantization) ProtoMessage()
func (*Quantization) ProtoReflect ¶ added in v0.2.0
func (x *Quantization) ProtoReflect() protoreflect.Message
func (*Quantization) Reset ¶ added in v0.2.0
func (x *Quantization) Reset()
func (*Quantization) String ¶ added in v0.2.0
func (x *Quantization) String() string
type Strings ¶
type Strings struct {
Val []string `protobuf:"bytes,1,rep,name=val,proto3" json:"val,omitempty"`
// contains filtered or unexported fields
}
Strings is a wrapper for repeated string values in attributes.
func (*Strings) Descriptor
deprecated
func (*Strings) ProtoMessage ¶
func (*Strings) ProtoMessage()
func (*Strings) ProtoReflect ¶
func (x *Strings) ProtoReflect() protoreflect.Message
type Tensor ¶
type Tensor struct {
Dtype Tensor_DataType `protobuf:"varint,1,opt,name=dtype,proto3,enum=zmf.Tensor_DataType" json:"dtype,omitempty"`
// The shape (dimensions) of the tensor.
Shape []int64 `protobuf:"varint,2,rep,packed,name=shape,proto3" json:"shape,omitempty"`
// The raw tensor data, stored as bytes.
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
// Optional quantization parameters for the tensor.
Quant *Quantization `protobuf:"bytes,4,opt,name=quant,proto3,oneof" json:"quant,omitempty"`
// contains filtered or unexported fields
}
Tensor represents a multi-dimensional array of data (e.g., a weight matrix).
func (*Tensor) Descriptor
deprecated
func (*Tensor) GetDtype ¶
func (x *Tensor) GetDtype() Tensor_DataType
func (*Tensor) GetQuant ¶ added in v0.2.0
func (x *Tensor) GetQuant() *Quantization
func (*Tensor) ProtoMessage ¶
func (*Tensor) ProtoMessage()
func (*Tensor) ProtoReflect ¶
func (x *Tensor) ProtoReflect() protoreflect.Message
type Tensor_DataType ¶
type Tensor_DataType int32
The data type of the tensor elements.
const ( Tensor_BFLOAT16 Tensor_DataType = 0 Tensor_BOOL Tensor_DataType = 1 Tensor_FLOAT16 Tensor_DataType = 2 Tensor_FLOAT32 Tensor_DataType = 3 Tensor_FLOAT64 Tensor_DataType = 4 Tensor_FLOAT8 Tensor_DataType = 5 Tensor_INT16 Tensor_DataType = 6 Tensor_INT32 Tensor_DataType = 7 Tensor_INT64 Tensor_DataType = 8 Tensor_INT8 Tensor_DataType = 9 Tensor_STRING Tensor_DataType = 10 Tensor_UINT32 Tensor_DataType = 11 Tensor_UINT64 Tensor_DataType = 12 Tensor_UINT8 Tensor_DataType = 13 )
func (Tensor_DataType) Descriptor ¶
func (Tensor_DataType) Descriptor() protoreflect.EnumDescriptor
func (Tensor_DataType) Enum ¶
func (x Tensor_DataType) Enum() *Tensor_DataType
func (Tensor_DataType) EnumDescriptor
deprecated
func (Tensor_DataType) EnumDescriptor() ([]byte, []int)
Deprecated: Use Tensor_DataType.Descriptor instead.
func (Tensor_DataType) Number ¶
func (x Tensor_DataType) Number() protoreflect.EnumNumber
func (Tensor_DataType) String ¶
func (x Tensor_DataType) String() string
func (Tensor_DataType) Type ¶
func (Tensor_DataType) Type() protoreflect.EnumType
type ValueInfo ¶
type ValueInfo struct {
// The name of the tensor.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// The data type of the tensor.
Dtype Tensor_DataType `protobuf:"varint,2,opt,name=dtype,proto3,enum=zmf.Tensor_DataType" json:"dtype,omitempty"`
// The shape of the tensor. A value of -1 can be used for dynamic dimensions.
Shape []int64 `protobuf:"varint,3,rep,packed,name=shape,proto3" json:"shape,omitempty"`
// contains filtered or unexported fields
}
ValueInfo describes a tensor, including its name, type, and shape.
func (*ValueInfo) Descriptor
deprecated
func (*ValueInfo) GetDtype ¶
func (x *ValueInfo) GetDtype() Tensor_DataType
func (*ValueInfo) ProtoMessage ¶
func (*ValueInfo) ProtoMessage()
func (*ValueInfo) ProtoReflect ¶
func (x *ValueInfo) ProtoReflect() protoreflect.Message