Documentation ¶
Overview ¶
Package onnx provides wrapper functionality around the onnx.proto3.pb.go The goal is to provide a stable(ish) api around the proto file since the proto file is generated based on onnx.proto.
Index ¶
- Variables
- func Int32ArrayToBoolArray(arr []int32) []bool
- func Int32ArrayToInt16Array(arr []int32) []int16
- func Int32ArrayToInt8Array(arr []int32) []int8
- func Int32ArrayToUint16Array(arr []int32) []uint16
- func Int32ArrayToUint8Array(arr []int32) []uint8
- func ReadBoolArrayFromBytes(data []byte) []bool
- func ReadFloat32ArrayFromBytes(data []byte) ([]float32, error)
- func ReadFloat64ArrayFromBytes(data []byte) ([]float64, error)
- func ReadInt16ArrayFromBytes(data []byte) ([]int16, error)
- func ReadInt32ArrayFromBytes(data []byte) ([]int32, error)
- func ReadInt64ArrayFromBytes(data []byte) ([]int64, error)
- func ReadInt8ArrayFromBytes(data []byte) ([]int8, error)
- func ReadUint16ArrayFromBytes(data []byte) ([]uint16, error)
- func ReadUint32ArrayFromBytes(data []byte) ([]uint32, error)
- func ReadUint64ArrayFromBytes(data []byte) ([]uint64, error)
- func ReadUint8ArrayFromBytes(data []byte) ([]uint8, error)
- func TensorFromProto(tp *TensorProto) (tensor.Tensor, error)
- func Uint64ArrayToUint32Array(arr []uint64) []uint32
- type AttributeProto
- func (*AttributeProto) Descriptor() ([]byte, []int)deprecated
- func (x *AttributeProto) GetDocString() string
- func (x *AttributeProto) GetF() float32
- func (x *AttributeProto) GetFloats() []float32
- func (x *AttributeProto) GetG() *GraphProto
- func (x *AttributeProto) GetGraphs() []*GraphProto
- func (x *AttributeProto) GetI() int64
- func (x *AttributeProto) GetInts() []int64
- func (x *AttributeProto) GetName() string
- func (x *AttributeProto) GetRefAttrName() string
- func (x *AttributeProto) GetS() []byte
- func (x *AttributeProto) GetSparseTensor() *SparseTensorProto
- func (x *AttributeProto) GetSparseTensors() []*SparseTensorProto
- func (x *AttributeProto) GetStrings() [][]byte
- func (x *AttributeProto) GetT() *TensorProto
- func (x *AttributeProto) GetTensors() []*TensorProto
- func (x *AttributeProto) GetTp() *TypeProto
- func (x *AttributeProto) GetType() AttributeProto_AttributeType
- func (x *AttributeProto) GetTypeProtos() []*TypeProto
- func (*AttributeProto) ProtoMessage()
- func (x *AttributeProto) ProtoReflect() protoreflect.Message
- func (x *AttributeProto) Reset()
- func (x *AttributeProto) String() string
- type AttributeProto_AttributeType
- func (AttributeProto_AttributeType) Descriptor() protoreflect.EnumDescriptor
- func (x AttributeProto_AttributeType) Enum() *AttributeProto_AttributeType
- func (AttributeProto_AttributeType) EnumDescriptor() ([]byte, []int)deprecated
- func (x AttributeProto_AttributeType) Number() protoreflect.EnumNumber
- func (x AttributeProto_AttributeType) String() string
- func (AttributeProto_AttributeType) Type() protoreflect.EnumType
- type Dim
- type FunctionProto
- func (*FunctionProto) Descriptor() ([]byte, []int)deprecated
- func (x *FunctionProto) GetAttribute() []string
- func (x *FunctionProto) GetDocString() string
- func (x *FunctionProto) GetDomain() string
- func (x *FunctionProto) GetInput() []string
- func (x *FunctionProto) GetName() string
- func (x *FunctionProto) GetNode() []*NodeProto
- func (x *FunctionProto) GetOpsetImport() []*OperatorSetIdProto
- func (x *FunctionProto) GetOutput() []string
- func (*FunctionProto) ProtoMessage()
- func (x *FunctionProto) ProtoReflect() protoreflect.Message
- func (x *FunctionProto) Reset()
- func (x *FunctionProto) String() string
- type GraphProto
- func (*GraphProto) Descriptor() ([]byte, []int)deprecated
- func (x *GraphProto) GetDocString() string
- func (x *GraphProto) GetInitializer() []*TensorProto
- func (x *GraphProto) GetInput() []*ValueInfoProto
- func (x *GraphProto) GetName() string
- func (x *GraphProto) GetNode() []*NodeProto
- func (x *GraphProto) GetOutput() []*ValueInfoProto
- func (x *GraphProto) GetQuantizationAnnotation() []*TensorAnnotation
- func (x *GraphProto) GetSparseInitializer() []*SparseTensorProto
- func (x *GraphProto) GetValueInfo() []*ValueInfoProto
- func (g *GraphProto) InputNames() []string
- func (g *GraphProto) InputShapes() Shapes
- func (g *GraphProto) OutputNames() []string
- func (g *GraphProto) OutputShapes() Shapes
- func (g *GraphProto) ParamNames() []string
- func (g *GraphProto) Params() (map[string]tensor.Tensor, error)
- func (*GraphProto) ProtoMessage()
- func (x *GraphProto) ProtoReflect() protoreflect.Message
- func (x *GraphProto) Reset()
- func (x *GraphProto) String() string
- type ModelProto
- func (*ModelProto) Descriptor() ([]byte, []int)deprecated
- func (x *ModelProto) GetDocString() string
- func (x *ModelProto) GetDomain() string
- func (x *ModelProto) GetFunctions() []*FunctionProto
- func (x *ModelProto) GetGraph() *GraphProto
- func (x *ModelProto) GetIrVersion() int64
- func (x *ModelProto) GetMetadataProps() []*StringStringEntryProto
- func (x *ModelProto) GetModelVersion() int64
- func (x *ModelProto) GetOpsetImport() []*OperatorSetIdProto
- func (x *ModelProto) GetProducerName() string
- func (x *ModelProto) GetProducerVersion() string
- func (x *ModelProto) GetTrainingInfo() []*TrainingInfoProto
- func (*ModelProto) ProtoMessage()
- func (x *ModelProto) ProtoReflect() protoreflect.Message
- func (x *ModelProto) Reset()
- func (x *ModelProto) String() string
- type NodeProto
- func (*NodeProto) Descriptor() ([]byte, []int)deprecated
- func (x *NodeProto) GetAttribute() []*AttributeProto
- func (x *NodeProto) GetDocString() string
- func (x *NodeProto) GetDomain() string
- func (x *NodeProto) GetInput() []string
- func (x *NodeProto) GetName() string
- func (x *NodeProto) GetOpType() string
- func (x *NodeProto) GetOutput() []string
- func (*NodeProto) ProtoMessage()
- func (x *NodeProto) ProtoReflect() protoreflect.Message
- func (x *NodeProto) Reset()
- func (x *NodeProto) String() string
- type OperatorSetIdProto
- func (*OperatorSetIdProto) Descriptor() ([]byte, []int)deprecated
- func (x *OperatorSetIdProto) GetDomain() string
- func (x *OperatorSetIdProto) GetVersion() int64
- func (*OperatorSetIdProto) ProtoMessage()
- func (x *OperatorSetIdProto) ProtoReflect() protoreflect.Message
- func (x *OperatorSetIdProto) Reset()
- func (x *OperatorSetIdProto) String() string
- type OperatorStatus
- func (OperatorStatus) Descriptor() protoreflect.EnumDescriptor
- func (x OperatorStatus) Enum() *OperatorStatus
- func (OperatorStatus) EnumDescriptor() ([]byte, []int)deprecated
- func (x OperatorStatus) Number() protoreflect.EnumNumber
- func (x OperatorStatus) String() string
- func (OperatorStatus) Type() protoreflect.EnumType
- type Shape
- type Shapes
- type SparseTensorProto
- func (*SparseTensorProto) Descriptor() ([]byte, []int)deprecated
- func (x *SparseTensorProto) GetDims() []int64
- func (x *SparseTensorProto) GetIndices() *TensorProto
- func (x *SparseTensorProto) GetValues() *TensorProto
- func (*SparseTensorProto) ProtoMessage()
- func (x *SparseTensorProto) ProtoReflect() protoreflect.Message
- func (x *SparseTensorProto) Reset()
- func (x *SparseTensorProto) String() string
- type StringStringEntryProto
- func (*StringStringEntryProto) Descriptor() ([]byte, []int)deprecated
- func (x *StringStringEntryProto) GetKey() string
- func (x *StringStringEntryProto) GetValue() string
- func (*StringStringEntryProto) ProtoMessage()
- func (x *StringStringEntryProto) ProtoReflect() protoreflect.Message
- func (x *StringStringEntryProto) Reset()
- func (x *StringStringEntryProto) String() string
- type TensorAnnotation
- func (*TensorAnnotation) Descriptor() ([]byte, []int)deprecated
- func (x *TensorAnnotation) GetQuantParameterTensorNames() []*StringStringEntryProto
- func (x *TensorAnnotation) GetTensorName() string
- func (*TensorAnnotation) ProtoMessage()
- func (x *TensorAnnotation) ProtoReflect() protoreflect.Message
- func (x *TensorAnnotation) Reset()
- func (x *TensorAnnotation) String() string
- type TensorProto
- func (*TensorProto) Descriptor() ([]byte, []int)deprecated
- func (x *TensorProto) GetDataLocation() TensorProto_DataLocation
- func (x *TensorProto) GetDataType() int32
- func (x *TensorProto) GetDims() []int64
- func (x *TensorProto) GetDocString() string
- func (x *TensorProto) GetDoubleData() []float64
- func (x *TensorProto) GetExternalData() []*StringStringEntryProto
- func (x *TensorProto) GetFloatData() []float32
- func (x *TensorProto) GetInt32Data() []int32
- func (x *TensorProto) GetInt64Data() []int64
- func (x *TensorProto) GetName() string
- func (x *TensorProto) GetRawData() []byte
- func (x *TensorProto) GetSegment() *TensorProto_Segment
- func (x *TensorProto) GetStringData() [][]byte
- func (x *TensorProto) GetUint64Data() []uint64
- func (*TensorProto) ProtoMessage()
- func (x *TensorProto) ProtoReflect() protoreflect.Message
- func (x *TensorProto) Reset()
- func (x *TensorProto) String() string
- type TensorProto_DataLocation
- func (TensorProto_DataLocation) Descriptor() protoreflect.EnumDescriptor
- func (x TensorProto_DataLocation) Enum() *TensorProto_DataLocation
- func (TensorProto_DataLocation) EnumDescriptor() ([]byte, []int)deprecated
- func (x TensorProto_DataLocation) Number() protoreflect.EnumNumber
- func (x TensorProto_DataLocation) String() string
- func (TensorProto_DataLocation) Type() protoreflect.EnumType
- type TensorProto_DataType
- func (TensorProto_DataType) Descriptor() protoreflect.EnumDescriptor
- func (x TensorProto_DataType) Enum() *TensorProto_DataType
- func (TensorProto_DataType) EnumDescriptor() ([]byte, []int)deprecated
- func (x TensorProto_DataType) Number() protoreflect.EnumNumber
- func (x TensorProto_DataType) String() string
- func (TensorProto_DataType) Type() protoreflect.EnumType
- type TensorProto_Segment
- func (*TensorProto_Segment) Descriptor() ([]byte, []int)deprecated
- func (x *TensorProto_Segment) GetBegin() int64
- func (x *TensorProto_Segment) GetEnd() int64
- func (*TensorProto_Segment) ProtoMessage()
- func (x *TensorProto_Segment) ProtoReflect() protoreflect.Message
- func (x *TensorProto_Segment) Reset()
- func (x *TensorProto_Segment) String() string
- type TensorShapeProto
- func (*TensorShapeProto) Descriptor() ([]byte, []int)deprecated
- func (x *TensorShapeProto) GetDim() []*TensorShapeProto_Dimension
- func (*TensorShapeProto) ProtoMessage()
- func (x *TensorShapeProto) ProtoReflect() protoreflect.Message
- func (x *TensorShapeProto) Reset()
- func (x *TensorShapeProto) String() string
- type TensorShapeProto_Dimension
- func (*TensorShapeProto_Dimension) Descriptor() ([]byte, []int)deprecated
- func (x *TensorShapeProto_Dimension) GetDenotation() string
- func (x *TensorShapeProto_Dimension) GetDimParam() string
- func (x *TensorShapeProto_Dimension) GetDimValue() int64
- func (m *TensorShapeProto_Dimension) GetValue() isTensorShapeProto_Dimension_Value
- func (*TensorShapeProto_Dimension) ProtoMessage()
- func (x *TensorShapeProto_Dimension) ProtoReflect() protoreflect.Message
- func (x *TensorShapeProto_Dimension) Reset()
- func (x *TensorShapeProto_Dimension) String() string
- type TensorShapeProto_Dimension_DimParam
- type TensorShapeProto_Dimension_DimValue
- type TrainingInfoProto
- func (*TrainingInfoProto) Descriptor() ([]byte, []int)deprecated
- func (x *TrainingInfoProto) GetAlgorithm() *GraphProto
- func (x *TrainingInfoProto) GetInitialization() *GraphProto
- func (x *TrainingInfoProto) GetInitializationBinding() []*StringStringEntryProto
- func (x *TrainingInfoProto) GetUpdateBinding() []*StringStringEntryProto
- func (*TrainingInfoProto) ProtoMessage()
- func (x *TrainingInfoProto) ProtoReflect() protoreflect.Message
- func (x *TrainingInfoProto) Reset()
- func (x *TrainingInfoProto) String() string
- type TypeProto
- func (*TypeProto) Descriptor() ([]byte, []int)deprecated
- func (x *TypeProto) GetDenotation() string
- func (x *TypeProto) GetMapType() *TypeProto_Map
- func (x *TypeProto) GetOptionalType() *TypeProto_Optional
- func (x *TypeProto) GetSequenceType() *TypeProto_Sequence
- func (x *TypeProto) GetSparseTensorType() *TypeProto_SparseTensor
- func (x *TypeProto) GetTensorType() *TypeProto_Tensor
- func (m *TypeProto) GetValue() isTypeProto_Value
- func (*TypeProto) ProtoMessage()
- func (x *TypeProto) ProtoReflect() protoreflect.Message
- func (x *TypeProto) Reset()
- func (x *TypeProto) String() string
- type TypeProto_Map
- func (*TypeProto_Map) Descriptor() ([]byte, []int)deprecated
- func (x *TypeProto_Map) GetKeyType() int32
- func (x *TypeProto_Map) GetValueType() *TypeProto
- func (*TypeProto_Map) ProtoMessage()
- func (x *TypeProto_Map) ProtoReflect() protoreflect.Message
- func (x *TypeProto_Map) Reset()
- func (x *TypeProto_Map) String() string
- type TypeProto_MapType
- type TypeProto_Optional
- func (*TypeProto_Optional) Descriptor() ([]byte, []int)deprecated
- func (x *TypeProto_Optional) GetElemType() *TypeProto
- func (*TypeProto_Optional) ProtoMessage()
- func (x *TypeProto_Optional) ProtoReflect() protoreflect.Message
- func (x *TypeProto_Optional) Reset()
- func (x *TypeProto_Optional) String() string
- type TypeProto_OptionalType
- type TypeProto_Sequence
- func (*TypeProto_Sequence) Descriptor() ([]byte, []int)deprecated
- func (x *TypeProto_Sequence) GetElemType() *TypeProto
- func (*TypeProto_Sequence) ProtoMessage()
- func (x *TypeProto_Sequence) ProtoReflect() protoreflect.Message
- func (x *TypeProto_Sequence) Reset()
- func (x *TypeProto_Sequence) String() string
- type TypeProto_SequenceType
- type TypeProto_SparseTensor
- func (*TypeProto_SparseTensor) Descriptor() ([]byte, []int)deprecated
- func (x *TypeProto_SparseTensor) GetElemType() int32
- func (x *TypeProto_SparseTensor) GetShape() *TensorShapeProto
- func (*TypeProto_SparseTensor) ProtoMessage()
- func (x *TypeProto_SparseTensor) ProtoReflect() protoreflect.Message
- func (x *TypeProto_SparseTensor) Reset()
- func (x *TypeProto_SparseTensor) String() string
- type TypeProto_SparseTensorType
- type TypeProto_Tensor
- func (*TypeProto_Tensor) Descriptor() ([]byte, []int)deprecated
- func (x *TypeProto_Tensor) GetElemType() int32
- func (x *TypeProto_Tensor) GetShape() *TensorShapeProto
- func (*TypeProto_Tensor) ProtoMessage()
- func (x *TypeProto_Tensor) ProtoReflect() protoreflect.Message
- func (x *TypeProto_Tensor) Reset()
- func (x *TypeProto_Tensor) String() string
- type TypeProto_TensorType
- type ValueInfoProto
- func (*ValueInfoProto) Descriptor() ([]byte, []int)deprecated
- func (x *ValueInfoProto) GetDocString() string
- func (x *ValueInfoProto) GetName() string
- func (x *ValueInfoProto) GetType() *TypeProto
- func (*ValueInfoProto) ProtoMessage()
- func (x *ValueInfoProto) ProtoReflect() protoreflect.Message
- func (x *ValueInfoProto) Reset()
- func (x *ValueInfoProto) String() string
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( Version_name = map[int32]string{ 0: "_START_VERSION", 1: "IR_VERSION_2017_10_10", 2: "IR_VERSION_2017_10_30", 3: "IR_VERSION_2017_11_3", 4: "IR_VERSION_2019_1_22", 5: "IR_VERSION_2019_3_18", 6: "IR_VERSION_2019_9_19", 7: "IR_VERSION_2020_5_8", 8: "IR_VERSION", } Version_value = map[string]int32{ "_START_VERSION": 0, "IR_VERSION_2017_10_10": 1, "IR_VERSION_2017_10_30": 2, "IR_VERSION_2017_11_3": 3, "IR_VERSION_2019_1_22": 4, "IR_VERSION_2019_3_18": 5, "IR_VERSION_2019_9_19": 6, "IR_VERSION_2020_5_8": 7, "IR_VERSION": 8, } )
Enum value maps for Version.
var ( OperatorStatus_name = map[int32]string{ 0: "EXPERIMENTAL", 1: "STABLE", } OperatorStatus_value = map[string]int32{ "EXPERIMENTAL": 0, "STABLE": 1, } )
Enum value maps for OperatorStatus.
var ( AttributeProto_AttributeType_name = map[int32]string{ 0: "UNDEFINED", 1: "FLOAT", 2: "INT", 3: "STRING", 4: "TENSOR", 5: "GRAPH", 11: "SPARSE_TENSOR", 13: "TYPE_PROTO", 6: "FLOATS", 7: "INTS", 8: "STRINGS", 9: "TENSORS", 10: "GRAPHS", 12: "SPARSE_TENSORS", 14: "TYPE_PROTOS", } AttributeProto_AttributeType_value = map[string]int32{ "UNDEFINED": 0, "FLOAT": 1, "INT": 2, "STRING": 3, "TENSOR": 4, "GRAPH": 5, "SPARSE_TENSOR": 11, "TYPE_PROTO": 13, "FLOATS": 6, "INTS": 7, "STRINGS": 8, "TENSORS": 9, "GRAPHS": 10, "SPARSE_TENSORS": 12, "TYPE_PROTOS": 14, } )
Enum value maps for AttributeProto_AttributeType.
var ( TensorProto_DataType_name = map[int32]string{ 0: "UNDEFINED", 1: "FLOAT", 2: "UINT8", 3: "INT8", 4: "UINT16", 5: "INT16", 6: "INT32", 7: "INT64", 8: "STRING", 9: "BOOL", 10: "FLOAT16", 11: "DOUBLE", 12: "UINT32", 13: "UINT64", 14: "COMPLEX64", 15: "COMPLEX128", 16: "BFLOAT16", } TensorProto_DataType_value = map[string]int32{ "UNDEFINED": 0, "FLOAT": 1, "UINT8": 2, "INT8": 3, "UINT16": 4, "INT16": 5, "INT32": 6, "INT64": 7, "STRING": 8, "BOOL": 9, "FLOAT16": 10, "DOUBLE": 11, "UINT32": 12, "UINT64": 13, "COMPLEX64": 14, "COMPLEX128": 15, "BFLOAT16": 16, } )
Enum value maps for TensorProto_DataType.
var ( TensorProto_DataLocation_name = map[int32]string{ 0: "DEFAULT", 1: "EXTERNAL", } TensorProto_DataLocation_value = map[string]int32{ "DEFAULT": 0, "EXTERNAL": 1, } )
Enum value maps for TensorProto_DataLocation.
var ErrInvalidType = errors.New("invalid type")
var File_onnx_proto3 protoreflect.FileDescriptor
Functions ¶
func Int32ArrayToBoolArray ¶
Int32ArrayToBoolArray converts an int32 array to a bool array. When the value is equal to 1 the boolean is considered to be true.
func Int32ArrayToInt16Array ¶
Int32ArrayToInt16Array converts an int32 array to a int16 array.
func Int32ArrayToInt8Array ¶
Int32ArrayToInt8Array converts an int32 array to an int8 array.
func Int32ArrayToUint16Array ¶
Int32ArrayToUint16Array converts an int32 array to a uint16 array.
func Int32ArrayToUint8Array ¶
Int32ArrayToUint8Array converts an int32 array to a uint8 array.
func ReadBoolArrayFromBytes ¶
ReadBoolArrayFromBytes reads data and parses it to an array of bool. The data is parsed to a bool by comparing the value to 0. If it is greater than 0, the bool is considered to be true.
func ReadFloat32ArrayFromBytes ¶
ReadFloat32ArrayFromBytes reads data and parses it to an array of float32.
func ReadFloat64ArrayFromBytes ¶
ReadFloat64ArrayFromBytes reads data and parses it to an array of float64.
func ReadInt16ArrayFromBytes ¶
ReadInt16ArrayFromBytes reads data and parses it to an array of int16.
func ReadInt32ArrayFromBytes ¶
ReadInt32ArrayFromBytes reads data and parses it to an array of int32.
func ReadInt64ArrayFromBytes ¶
ReadInt64ArrayFromBytes reads data and parses it to an array of float32.
func ReadInt8ArrayFromBytes ¶
ReadInt8ArrayFromBytes reads data and parses it to an array of int8.
func ReadUint16ArrayFromBytes ¶
ReadUint16ArrayFromBytes reads data and parses it to an array of uint16.
func ReadUint32ArrayFromBytes ¶
ReadUint32ArrayFromBytes reads data and parses it to an array of uint32.
func ReadUint64ArrayFromBytes ¶
ReadUint64ArrayFromBytes reads data and parses it to an array of uint64.
func ReadUint8ArrayFromBytes ¶
ReadUint8ArrayFromBytes reads data and parses it to an array of uint8.
func TensorFromProto ¶
func TensorFromProto(tp *TensorProto) (tensor.Tensor, error)
TensorFromProto returns a tensor.Tensor from an onnx.TensorProto.
func Uint64ArrayToUint32Array ¶
Uint64ArrayToUint32Array converts an uint64 array to a uint32 array.
Types ¶
type AttributeProto ¶
type AttributeProto struct { // The name field MUST be present for this version of the IR. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // namespace Attribute // if ref_attr_name is not empty, ref_attr_name is the attribute name in parent function. // In this case, this AttributeProto does not contain data, and it's a reference of attribute // in parent scope. // NOTE: This should ONLY be used in function (sub-graph). It's invalid to be used in main graph. RefAttrName string `protobuf:"bytes,21,opt,name=ref_attr_name,json=refAttrName,proto3" json:"ref_attr_name,omitempty"` // A human-readable documentation for this attribute. Markdown is allowed. DocString string `protobuf:"bytes,13,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` // The type field MUST be present for this version of the IR. // For 0.0.1 versions of the IR, this field was not defined, and // implementations needed to use has_field heuristics to determine // which value field was in use. For IR_VERSION 0.0.2 or later, this // field MUST be set and match the f|i|s|t|... field in use. This // change was made to accommodate proto3 implementations. Type AttributeProto_AttributeType `protobuf:"varint,20,opt,name=type,proto3,enum=onnx.AttributeProto_AttributeType" json:"type,omitempty"` // discriminator that indicates which field below is in use // Exactly ONE of the following fields must be present for this version of the IR F float32 `protobuf:"fixed32,2,opt,name=f,proto3" json:"f,omitempty"` // float I int64 `protobuf:"varint,3,opt,name=i,proto3" json:"i,omitempty"` // int S []byte `protobuf:"bytes,4,opt,name=s,proto3" json:"s,omitempty"` // UTF-8 string T *TensorProto `protobuf:"bytes,5,opt,name=t,proto3" json:"t,omitempty"` // tensor value G *GraphProto `protobuf:"bytes,6,opt,name=g,proto3" json:"g,omitempty"` // graph SparseTensor *SparseTensorProto `protobuf:"bytes,22,opt,name=sparse_tensor,json=sparseTensor,proto3" json:"sparse_tensor,omitempty"` // sparse tensor value // Do not use field below, it's deprecated. // optional ValueProto v = 12; // value - subsumes everything but graph Tp *TypeProto `protobuf:"bytes,14,opt,name=tp,proto3" json:"tp,omitempty"` // type proto Floats []float32 `protobuf:"fixed32,7,rep,packed,name=floats,proto3" json:"floats,omitempty"` // list of floats Ints []int64 `protobuf:"varint,8,rep,packed,name=ints,proto3" json:"ints,omitempty"` // list of ints Strings [][]byte `protobuf:"bytes,9,rep,name=strings,proto3" json:"strings,omitempty"` // list of UTF-8 strings Tensors []*TensorProto `protobuf:"bytes,10,rep,name=tensors,proto3" json:"tensors,omitempty"` // list of tensors Graphs []*GraphProto `protobuf:"bytes,11,rep,name=graphs,proto3" json:"graphs,omitempty"` // list of graph SparseTensors []*SparseTensorProto `protobuf:"bytes,23,rep,name=sparse_tensors,json=sparseTensors,proto3" json:"sparse_tensors,omitempty"` // list of sparse tensors TypeProtos []*TypeProto `protobuf:"bytes,15,rep,name=type_protos,json=typeProtos,proto3" json:"type_protos,omitempty"` // list of type protos // contains filtered or unexported fields }
Attributes
A named attribute containing either singular float, integer, string, graph, and tensor values, or repeated float, integer, string, graph, and tensor values. An AttributeProto MUST contain the name field, and *only one* of the following content fields, effectively enforcing a C/C++ union equivalent.
func (*AttributeProto) Descriptor
deprecated
func (*AttributeProto) Descriptor() ([]byte, []int)
Deprecated: Use AttributeProto.ProtoReflect.Descriptor instead.
func (*AttributeProto) GetDocString ¶
func (x *AttributeProto) GetDocString() string
func (*AttributeProto) GetF ¶
func (x *AttributeProto) GetF() float32
func (*AttributeProto) GetFloats ¶
func (x *AttributeProto) GetFloats() []float32
func (*AttributeProto) GetG ¶
func (x *AttributeProto) GetG() *GraphProto
func (*AttributeProto) GetGraphs ¶
func (x *AttributeProto) GetGraphs() []*GraphProto
func (*AttributeProto) GetI ¶
func (x *AttributeProto) GetI() int64
func (*AttributeProto) GetInts ¶
func (x *AttributeProto) GetInts() []int64
func (*AttributeProto) GetName ¶
func (x *AttributeProto) GetName() string
func (*AttributeProto) GetRefAttrName ¶
func (x *AttributeProto) GetRefAttrName() string
func (*AttributeProto) GetS ¶
func (x *AttributeProto) GetS() []byte
func (*AttributeProto) GetSparseTensor ¶
func (x *AttributeProto) GetSparseTensor() *SparseTensorProto
func (*AttributeProto) GetSparseTensors ¶
func (x *AttributeProto) GetSparseTensors() []*SparseTensorProto
func (*AttributeProto) GetStrings ¶
func (x *AttributeProto) GetStrings() [][]byte
func (*AttributeProto) GetT ¶
func (x *AttributeProto) GetT() *TensorProto
func (*AttributeProto) GetTensors ¶
func (x *AttributeProto) GetTensors() []*TensorProto
func (*AttributeProto) GetTp ¶
func (x *AttributeProto) GetTp() *TypeProto
func (*AttributeProto) GetType ¶
func (x *AttributeProto) GetType() AttributeProto_AttributeType
func (*AttributeProto) GetTypeProtos ¶
func (x *AttributeProto) GetTypeProtos() []*TypeProto
func (*AttributeProto) ProtoMessage ¶
func (*AttributeProto) ProtoMessage()
func (*AttributeProto) ProtoReflect ¶
func (x *AttributeProto) ProtoReflect() protoreflect.Message
func (*AttributeProto) Reset ¶
func (x *AttributeProto) Reset()
func (*AttributeProto) String ¶
func (x *AttributeProto) String() string
type AttributeProto_AttributeType ¶
type AttributeProto_AttributeType int32
Note: this enum is structurally identical to the OpSchema::AttrType enum defined in schema.h. If you rev one, you likely need to rev the other.
const ( AttributeProto_UNDEFINED AttributeProto_AttributeType = 0 AttributeProto_FLOAT AttributeProto_AttributeType = 1 AttributeProto_INT AttributeProto_AttributeType = 2 AttributeProto_STRING AttributeProto_AttributeType = 3 AttributeProto_TENSOR AttributeProto_AttributeType = 4 AttributeProto_GRAPH AttributeProto_AttributeType = 5 AttributeProto_SPARSE_TENSOR AttributeProto_AttributeType = 11 AttributeProto_TYPE_PROTO AttributeProto_AttributeType = 13 AttributeProto_FLOATS AttributeProto_AttributeType = 6 AttributeProto_INTS AttributeProto_AttributeType = 7 AttributeProto_STRINGS AttributeProto_AttributeType = 8 AttributeProto_TENSORS AttributeProto_AttributeType = 9 AttributeProto_GRAPHS AttributeProto_AttributeType = 10 AttributeProto_SPARSE_TENSORS AttributeProto_AttributeType = 12 AttributeProto_TYPE_PROTOS AttributeProto_AttributeType = 14 )
func (AttributeProto_AttributeType) Descriptor ¶
func (AttributeProto_AttributeType) Descriptor() protoreflect.EnumDescriptor
func (AttributeProto_AttributeType) Enum ¶
func (x AttributeProto_AttributeType) Enum() *AttributeProto_AttributeType
func (AttributeProto_AttributeType) EnumDescriptor
deprecated
func (AttributeProto_AttributeType) EnumDescriptor() ([]byte, []int)
Deprecated: Use AttributeProto_AttributeType.Descriptor instead.
func (AttributeProto_AttributeType) Number ¶
func (x AttributeProto_AttributeType) Number() protoreflect.EnumNumber
func (AttributeProto_AttributeType) String ¶
func (x AttributeProto_AttributeType) String() string
func (AttributeProto_AttributeType) Type ¶
func (AttributeProto_AttributeType) Type() protoreflect.EnumType
type FunctionProto ¶
type FunctionProto struct { // The name of the function, similar usage of op_type in OperatorProto. // Combined with FunctionProto.domain, this forms the unique identity of // the FunctionProto. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The inputs and outputs of the function. Input []string `protobuf:"bytes,4,rep,name=input,proto3" json:"input,omitempty"` Output []string `protobuf:"bytes,5,rep,name=output,proto3" json:"output,omitempty"` // The attributes of the function. Attribute []string `protobuf:"bytes,6,rep,name=attribute,proto3" json:"attribute,omitempty"` // The nodes in the function. Node []*NodeProto `protobuf:"bytes,7,rep,name=node,proto3" json:"node,omitempty"` // A human-readable documentation for this function. Markdown is allowed. DocString string `protobuf:"bytes,8,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` OpsetImport []*OperatorSetIdProto `protobuf:"bytes,9,rep,name=opset_import,json=opsetImport,proto3" json:"opset_import,omitempty"` // The domain which this function belongs to. Combined with FunctionProto.name, this forms the unique identity of // the FunctionProto. Domain string `protobuf:"bytes,10,opt,name=domain,proto3" json:"domain,omitempty"` // contains filtered or unexported fields }
func (*FunctionProto) Descriptor
deprecated
func (*FunctionProto) Descriptor() ([]byte, []int)
Deprecated: Use FunctionProto.ProtoReflect.Descriptor instead.
func (*FunctionProto) GetAttribute ¶
func (x *FunctionProto) GetAttribute() []string
func (*FunctionProto) GetDocString ¶
func (x *FunctionProto) GetDocString() string
func (*FunctionProto) GetDomain ¶
func (x *FunctionProto) GetDomain() string
func (*FunctionProto) GetInput ¶
func (x *FunctionProto) GetInput() []string
func (*FunctionProto) GetName ¶
func (x *FunctionProto) GetName() string
func (*FunctionProto) GetNode ¶
func (x *FunctionProto) GetNode() []*NodeProto
func (*FunctionProto) GetOpsetImport ¶
func (x *FunctionProto) GetOpsetImport() []*OperatorSetIdProto
func (*FunctionProto) GetOutput ¶
func (x *FunctionProto) GetOutput() []string
func (*FunctionProto) ProtoMessage ¶
func (*FunctionProto) ProtoMessage()
func (*FunctionProto) ProtoReflect ¶
func (x *FunctionProto) ProtoReflect() protoreflect.Message
func (*FunctionProto) Reset ¶
func (x *FunctionProto) Reset()
func (*FunctionProto) String ¶
func (x *FunctionProto) String() string
type GraphProto ¶
type GraphProto struct { // The nodes in the graph, sorted topologically. Node []*NodeProto `protobuf:"bytes,1,rep,name=node,proto3" json:"node,omitempty"` // The name of the graph. Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // namespace Graph // A list of named tensor values, used to specify constant inputs of the graph. // Each initializer (both TensorProto as well SparseTensorProto) MUST have a name. // The name MUST be unique across both initializer and sparse_initializer, // but the name MAY also appear in the input list. Initializer []*TensorProto `protobuf:"bytes,5,rep,name=initializer,proto3" json:"initializer,omitempty"` // Initializers (see above) stored in sparse format. SparseInitializer []*SparseTensorProto `protobuf:"bytes,15,rep,name=sparse_initializer,json=sparseInitializer,proto3" json:"sparse_initializer,omitempty"` // A human-readable documentation for this graph. Markdown is allowed. DocString string `protobuf:"bytes,10,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` // The inputs and outputs of the graph. Input []*ValueInfoProto `protobuf:"bytes,11,rep,name=input,proto3" json:"input,omitempty"` Output []*ValueInfoProto `protobuf:"bytes,12,rep,name=output,proto3" json:"output,omitempty"` // Information for the values in the graph. The ValueInfoProto.name's // must be distinct. It is optional for a value to appear in value_info list. ValueInfo []*ValueInfoProto `protobuf:"bytes,13,rep,name=value_info,json=valueInfo,proto3" json:"value_info,omitempty"` // This field carries information to indicate the mapping among a tensor and its // quantization parameter tensors. For example: // For tensor 'a', it may have {'SCALE_TENSOR', 'a_scale'} and {'ZERO_POINT_TENSOR', 'a_zero_point'} annotated, // which means, tensor 'a_scale' and tensor 'a_zero_point' are scale and zero point of tensor 'a' in the model. QuantizationAnnotation []*TensorAnnotation `` /* 128-byte string literal not displayed */ // contains filtered or unexported fields }
Graphs
A graph defines the computational logic of a model and is comprised of a parameterized list of nodes that form a directed acyclic graph based on their inputs and outputs. This is the equivalent of the "network" or "graph" in many deep learning frameworks.
func (*GraphProto) Descriptor
deprecated
func (*GraphProto) Descriptor() ([]byte, []int)
Deprecated: Use GraphProto.ProtoReflect.Descriptor instead.
func (*GraphProto) GetDocString ¶
func (x *GraphProto) GetDocString() string
func (*GraphProto) GetInitializer ¶
func (x *GraphProto) GetInitializer() []*TensorProto
func (*GraphProto) GetInput ¶
func (x *GraphProto) GetInput() []*ValueInfoProto
func (*GraphProto) GetName ¶
func (x *GraphProto) GetName() string
func (*GraphProto) GetNode ¶
func (x *GraphProto) GetNode() []*NodeProto
func (*GraphProto) GetOutput ¶
func (x *GraphProto) GetOutput() []*ValueInfoProto
func (*GraphProto) GetQuantizationAnnotation ¶
func (x *GraphProto) GetQuantizationAnnotation() []*TensorAnnotation
func (*GraphProto) GetSparseInitializer ¶
func (x *GraphProto) GetSparseInitializer() []*SparseTensorProto
func (*GraphProto) GetValueInfo ¶
func (x *GraphProto) GetValueInfo() []*ValueInfoProto
func (*GraphProto) InputNames ¶
func (g *GraphProto) InputNames() []string
InputNames returns the input names for a GraphProto.
func (*GraphProto) InputShapes ¶
func (g *GraphProto) InputShapes() Shapes
InputShapes returns the input shapes for a GraphProto.
func (*GraphProto) OutputNames ¶
func (g *GraphProto) OutputNames() []string
OutputNames returns the output names for a GraphProto.
func (*GraphProto) OutputShapes ¶
func (g *GraphProto) OutputShapes() Shapes
OutputShapes returns the output shapes for a GraphProto.
func (*GraphProto) ParamNames ¶
func (g *GraphProto) ParamNames() []string
ParamNames returns the names of the parameters as defined by the GraphProto.
func (*GraphProto) Params ¶
func (g *GraphProto) Params() (map[string]tensor.Tensor, error)
Params returns the parameters of the graph proto as a map of tensors.
func (*GraphProto) ProtoMessage ¶
func (*GraphProto) ProtoMessage()
func (*GraphProto) ProtoReflect ¶
func (x *GraphProto) ProtoReflect() protoreflect.Message
func (*GraphProto) Reset ¶
func (x *GraphProto) Reset()
func (*GraphProto) String ¶
func (x *GraphProto) String() string
type ModelProto ¶
type ModelProto struct { // The version of the IR this model targets. See Version enum above. // This field MUST be present. IrVersion int64 `protobuf:"varint,1,opt,name=ir_version,json=irVersion,proto3" json:"ir_version,omitempty"` // The OperatorSets this model relies on. // All ModelProtos MUST have at least one entry that // specifies which version of the ONNX OperatorSet is // being imported. // // All nodes in the ModelProto's graph will bind against the operator // with the same-domain/same-op_type operator with the HIGHEST version // in the referenced operator sets. OpsetImport []*OperatorSetIdProto `protobuf:"bytes,8,rep,name=opset_import,json=opsetImport,proto3" json:"opset_import,omitempty"` // The name of the framework or tool used to generate this model. // This field SHOULD be present to indicate which implementation/tool/framework // emitted the model. ProducerName string `protobuf:"bytes,2,opt,name=producer_name,json=producerName,proto3" json:"producer_name,omitempty"` // The version of the framework or tool used to generate this model. // This field SHOULD be present to indicate which implementation/tool/framework // emitted the model. ProducerVersion string `protobuf:"bytes,3,opt,name=producer_version,json=producerVersion,proto3" json:"producer_version,omitempty"` // Domain name of the model. // We use reverse domain names as name space indicators. For example: // `com.facebook.fair` or `com.microsoft.cognitiveservices` // // Together with `model_version` and GraphProto.name, this forms the unique identity of // the graph. Domain string `protobuf:"bytes,4,opt,name=domain,proto3" json:"domain,omitempty"` // The version of the graph encoded. See Version enum below. ModelVersion int64 `protobuf:"varint,5,opt,name=model_version,json=modelVersion,proto3" json:"model_version,omitempty"` // A human-readable documentation for this model. Markdown is allowed. DocString string `protobuf:"bytes,6,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` // The parameterized graph that is evaluated to execute the model. Graph *GraphProto `protobuf:"bytes,7,opt,name=graph,proto3" json:"graph,omitempty"` // Named metadata values; keys should be distinct. MetadataProps []*StringStringEntryProto `protobuf:"bytes,14,rep,name=metadata_props,json=metadataProps,proto3" json:"metadata_props,omitempty"` // Training-specific information. Sequentially executing all stored // `TrainingInfoProto.algorithm`s and assigning their outputs following // the corresponding `TrainingInfoProto.update_binding`s is one training // iteration. Similarly, to initialize the model // (as if training hasn't happened), the user should sequentially execute // all stored `TrainingInfoProto.initialization`s and assigns their outputs // using `TrainingInfoProto.initialization_binding`s. // // If this field is empty, the training behavior of the model is undefined. TrainingInfo []*TrainingInfoProto `protobuf:"bytes,20,rep,name=training_info,json=trainingInfo,proto3" json:"training_info,omitempty"` // A list of function protos local to the model. // // Name of the function "FunctionProto.name" should be unique within the domain "FunctionProto.domain". // In case of any conflicts the behavior (whether the model local functions are given higher priority, // or standard opserator sets are given higher priotity or this is treated as error) is defined by // the runtimes. // // The operator sets imported by FunctionProto should be compatible with the ones // imported by ModelProto and other model local FunctionProtos. // Example, if same operator set say 'A' is imported by a FunctionProto and ModelProto // or by 2 FunctionProtos then versions for the operator set may be different but, // the operator schema returned for op_type, domain, version combination // for both the versions should be same for every node in the function body. // // One FunctionProto can reference other FunctionProto in the model, however, recursive reference // is not allowed. Functions []*FunctionProto `protobuf:"bytes,25,rep,name=functions,proto3" json:"functions,omitempty"` // contains filtered or unexported fields }
Models
ModelProto is a top-level file/container format for bundling a ML model and associating its computation graph with metadata.
The semantics of the model are described by the associated GraphProto's.
func (*ModelProto) Descriptor
deprecated
func (*ModelProto) Descriptor() ([]byte, []int)
Deprecated: Use ModelProto.ProtoReflect.Descriptor instead.
func (*ModelProto) GetDocString ¶
func (x *ModelProto) GetDocString() string
func (*ModelProto) GetDomain ¶
func (x *ModelProto) GetDomain() string
func (*ModelProto) GetFunctions ¶
func (x *ModelProto) GetFunctions() []*FunctionProto
func (*ModelProto) GetGraph ¶
func (x *ModelProto) GetGraph() *GraphProto
func (*ModelProto) GetIrVersion ¶
func (x *ModelProto) GetIrVersion() int64
func (*ModelProto) GetMetadataProps ¶
func (x *ModelProto) GetMetadataProps() []*StringStringEntryProto
func (*ModelProto) GetModelVersion ¶
func (x *ModelProto) GetModelVersion() int64
func (*ModelProto) GetOpsetImport ¶
func (x *ModelProto) GetOpsetImport() []*OperatorSetIdProto
func (*ModelProto) GetProducerName ¶
func (x *ModelProto) GetProducerName() string
func (*ModelProto) GetProducerVersion ¶
func (x *ModelProto) GetProducerVersion() string
func (*ModelProto) GetTrainingInfo ¶
func (x *ModelProto) GetTrainingInfo() []*TrainingInfoProto
func (*ModelProto) ProtoMessage ¶
func (*ModelProto) ProtoMessage()
func (*ModelProto) ProtoReflect ¶
func (x *ModelProto) ProtoReflect() protoreflect.Message
func (*ModelProto) Reset ¶
func (x *ModelProto) Reset()
func (*ModelProto) String ¶
func (x *ModelProto) String() string
type NodeProto ¶
type NodeProto struct { Input []string `protobuf:"bytes,1,rep,name=input,proto3" json:"input,omitempty"` // namespace Value Output []string `protobuf:"bytes,2,rep,name=output,proto3" json:"output,omitempty"` // namespace Value // An optional identifier for this node in a graph. // This field MAY be absent in ths version of the IR. Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // namespace Node // The symbolic identifier of the Operator to execute. OpType string `protobuf:"bytes,4,opt,name=op_type,json=opType,proto3" json:"op_type,omitempty"` // namespace Operator // The domain of the OperatorSet that specifies the operator named by op_type. Domain string `protobuf:"bytes,7,opt,name=domain,proto3" json:"domain,omitempty"` // namespace Domain // Additional named attributes. Attribute []*AttributeProto `protobuf:"bytes,5,rep,name=attribute,proto3" json:"attribute,omitempty"` // A human-readable documentation for this node. Markdown is allowed. DocString string `protobuf:"bytes,6,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` // contains filtered or unexported fields }
Nodes
Computation graphs are made up of a DAG of nodes, which represent what is commonly called a "layer" or "pipeline stage" in machine learning frameworks.
For example, it can be a node of type "Conv" that takes in an image, a filter tensor and a bias tensor, and produces the convolved output.
func (*NodeProto) Descriptor
deprecated
func (*NodeProto) GetAttribute ¶
func (x *NodeProto) GetAttribute() []*AttributeProto
func (*NodeProto) GetDocString ¶
func (*NodeProto) ProtoMessage ¶
func (*NodeProto) ProtoMessage()
func (*NodeProto) ProtoReflect ¶
func (x *NodeProto) ProtoReflect() protoreflect.Message
type OperatorSetIdProto ¶
type OperatorSetIdProto struct { // The domain of the operator set being identified. // The empty string ("") or absence of this field implies the operator // set that is defined as part of the ONNX specification. // This field MUST be present in this version of the IR when referring to any other operator set. Domain string `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain,omitempty"` // The version of the operator set being identified. // This field MUST be present in this version of the IR. Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` // contains filtered or unexported fields }
Operator Sets
OperatorSets are uniquely identified by a (domain, opset_version) pair.
func (*OperatorSetIdProto) Descriptor
deprecated
func (*OperatorSetIdProto) Descriptor() ([]byte, []int)
Deprecated: Use OperatorSetIdProto.ProtoReflect.Descriptor instead.
func (*OperatorSetIdProto) GetDomain ¶
func (x *OperatorSetIdProto) GetDomain() string
func (*OperatorSetIdProto) GetVersion ¶
func (x *OperatorSetIdProto) GetVersion() int64
func (*OperatorSetIdProto) ProtoMessage ¶
func (*OperatorSetIdProto) ProtoMessage()
func (*OperatorSetIdProto) ProtoReflect ¶
func (x *OperatorSetIdProto) ProtoReflect() protoreflect.Message
func (*OperatorSetIdProto) Reset ¶
func (x *OperatorSetIdProto) Reset()
func (*OperatorSetIdProto) String ¶
func (x *OperatorSetIdProto) String() string
type OperatorStatus ¶
type OperatorStatus int32
Operator/function status.
const ( OperatorStatus_EXPERIMENTAL OperatorStatus = 0 OperatorStatus_STABLE OperatorStatus = 1 )
func (OperatorStatus) Descriptor ¶
func (OperatorStatus) Descriptor() protoreflect.EnumDescriptor
func (OperatorStatus) Enum ¶
func (x OperatorStatus) Enum() *OperatorStatus
func (OperatorStatus) EnumDescriptor
deprecated
func (OperatorStatus) EnumDescriptor() ([]byte, []int)
Deprecated: Use OperatorStatus.Descriptor instead.
func (OperatorStatus) Number ¶
func (x OperatorStatus) Number() protoreflect.EnumNumber
func (OperatorStatus) String ¶
func (x OperatorStatus) String() string
func (OperatorStatus) Type ¶
func (OperatorStatus) Type() protoreflect.EnumType
type SparseTensorProto ¶
type SparseTensorProto struct { // The sequence of non-default values are encoded as a tensor of shape [NNZ]. // The default-value is zero for numeric tensors, and empty-string for string tensors. // values must have a non-empty name present which serves as a name for SparseTensorProto // when used in sparse_initializer list. Values *TensorProto `protobuf:"bytes,1,opt,name=values,proto3" json:"values,omitempty"` // The indices of the non-default values, which may be stored in one of two formats. // (a) Indices can be a tensor of shape [NNZ, rank] with the [i,j]-th value // corresponding to the j-th index of the i-th value (in the values tensor). // (b) Indices can be a tensor of shape [NNZ], in which case the i-th value // must be the linearized-index of the i-th value (in the values tensor). // The linearized-index can be converted into an index tuple (k_1,...,k_rank) // using the shape provided below. // The indices must appear in ascending order without duplication. // In the first format, the ordering is lexicographic-ordering: // e.g., index-value [1,4] must appear before [2,1] Indices *TensorProto `protobuf:"bytes,2,opt,name=indices,proto3" json:"indices,omitempty"` // The shape of the underlying dense-tensor: [dim_1, dim_2, ... dim_rank] Dims []int64 `protobuf:"varint,3,rep,packed,name=dims,proto3" json:"dims,omitempty"` // contains filtered or unexported fields }
A serialized sparse-tensor value
func (*SparseTensorProto) Descriptor
deprecated
func (*SparseTensorProto) Descriptor() ([]byte, []int)
Deprecated: Use SparseTensorProto.ProtoReflect.Descriptor instead.
func (*SparseTensorProto) GetDims ¶
func (x *SparseTensorProto) GetDims() []int64
func (*SparseTensorProto) GetIndices ¶
func (x *SparseTensorProto) GetIndices() *TensorProto
func (*SparseTensorProto) GetValues ¶
func (x *SparseTensorProto) GetValues() *TensorProto
func (*SparseTensorProto) ProtoMessage ¶
func (*SparseTensorProto) ProtoMessage()
func (*SparseTensorProto) ProtoReflect ¶
func (x *SparseTensorProto) ProtoReflect() protoreflect.Message
func (*SparseTensorProto) Reset ¶
func (x *SparseTensorProto) Reset()
func (*SparseTensorProto) String ¶
func (x *SparseTensorProto) String() string
type StringStringEntryProto ¶
type StringStringEntryProto struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
StringStringEntryProto follows the pattern for cross-proto-version maps. See https://developers.google.com/protocol-buffers/docs/proto3#maps
func (*StringStringEntryProto) Descriptor
deprecated
func (*StringStringEntryProto) Descriptor() ([]byte, []int)
Deprecated: Use StringStringEntryProto.ProtoReflect.Descriptor instead.
func (*StringStringEntryProto) GetKey ¶
func (x *StringStringEntryProto) GetKey() string
func (*StringStringEntryProto) GetValue ¶
func (x *StringStringEntryProto) GetValue() string
func (*StringStringEntryProto) ProtoMessage ¶
func (*StringStringEntryProto) ProtoMessage()
func (*StringStringEntryProto) ProtoReflect ¶
func (x *StringStringEntryProto) ProtoReflect() protoreflect.Message
func (*StringStringEntryProto) Reset ¶
func (x *StringStringEntryProto) Reset()
func (*StringStringEntryProto) String ¶
func (x *StringStringEntryProto) String() string
type TensorAnnotation ¶
type TensorAnnotation struct { TensorName string `protobuf:"bytes,1,opt,name=tensor_name,json=tensorName,proto3" json:"tensor_name,omitempty"` // <key, value> pairs to annotate tensor specified by <tensor_name> above. // The keys used in the mapping below must be pre-defined in ONNX spec. // For example, for 8-bit linear quantization case, 'SCALE_TENSOR', 'ZERO_POINT_TENSOR' will be pre-defined as // quantization parameter keys. QuantParameterTensorNames []*StringStringEntryProto `` /* 140-byte string literal not displayed */ // contains filtered or unexported fields }
func (*TensorAnnotation) Descriptor
deprecated
func (*TensorAnnotation) Descriptor() ([]byte, []int)
Deprecated: Use TensorAnnotation.ProtoReflect.Descriptor instead.
func (*TensorAnnotation) GetQuantParameterTensorNames ¶
func (x *TensorAnnotation) GetQuantParameterTensorNames() []*StringStringEntryProto
func (*TensorAnnotation) GetTensorName ¶
func (x *TensorAnnotation) GetTensorName() string
func (*TensorAnnotation) ProtoMessage ¶
func (*TensorAnnotation) ProtoMessage()
func (*TensorAnnotation) ProtoReflect ¶
func (x *TensorAnnotation) ProtoReflect() protoreflect.Message
func (*TensorAnnotation) Reset ¶
func (x *TensorAnnotation) Reset()
func (*TensorAnnotation) String ¶
func (x *TensorAnnotation) String() string
type TensorProto ¶
type TensorProto struct { // The shape of the tensor. Dims []int64 `protobuf:"varint,1,rep,packed,name=dims,proto3" json:"dims,omitempty"` // The data type of the tensor. // This field MUST have a valid TensorProto.DataType value DataType int32 `protobuf:"varint,2,opt,name=data_type,json=dataType,proto3" json:"data_type,omitempty"` Segment *TensorProto_Segment `protobuf:"bytes,3,opt,name=segment,proto3" json:"segment,omitempty"` // For float and complex64 values // Complex64 tensors are encoded as a single array of floats, // with the real components appearing in odd numbered positions, // and the corresponding imaginary component appearing in the // subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] // is encoded as [1.0, 2.0 ,3.0 ,4.0] // When this field is present, the data_type field MUST be FLOAT or COMPLEX64. FloatData []float32 `protobuf:"fixed32,4,rep,packed,name=float_data,json=floatData,proto3" json:"float_data,omitempty"` // For int32, uint8, int8, uint16, int16, bool, and float16 values // float16 values must be bit-wise converted to an uint16_t prior // to writing to the buffer. // When this field is present, the data_type field MUST be // INT32, INT16, INT8, UINT16, UINT8, BOOL, or FLOAT16 Int32Data []int32 `protobuf:"varint,5,rep,packed,name=int32_data,json=int32Data,proto3" json:"int32_data,omitempty"` // For strings. // Each element of string_data is a UTF-8 encoded Unicode // string. No trailing null, no leading BOM. The protobuf "string" // scalar type is not used to match ML community conventions. // When this field is present, the data_type field MUST be STRING StringData [][]byte `protobuf:"bytes,6,rep,name=string_data,json=stringData,proto3" json:"string_data,omitempty"` // For int64. // When this field is present, the data_type field MUST be INT64 Int64Data []int64 `protobuf:"varint,7,rep,packed,name=int64_data,json=int64Data,proto3" json:"int64_data,omitempty"` // Optionally, a name for the tensor. Name string `protobuf:"bytes,8,opt,name=name,proto3" json:"name,omitempty"` // namespace Value // A human-readable documentation for this tensor. Markdown is allowed. DocString string `protobuf:"bytes,12,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` // Serializations can either use one of the fields above, or use this // raw bytes field. The only exception is the string case, where one is // required to store the content in the repeated bytes string_data field. // // When this raw_data field is used to store tensor value, elements MUST // be stored in as fixed-width, little-endian order. // Floating-point data types MUST be stored in IEEE 754 format. // Complex64 elements must be written as two consecutive FLOAT values, real component first. // Complex128 elements must be written as two consecutive DOUBLE values, real component first. // Boolean type MUST be written one byte per tensor element (00000001 for true, 00000000 for false). // // Note: the advantage of specific field rather than the raw_data field is // that in some cases (e.g. int data), protobuf does a better packing via // variable length storage, and may lead to smaller binary footprint. // When this field is present, the data_type field MUST NOT be STRING or UNDEFINED RawData []byte `protobuf:"bytes,9,opt,name=raw_data,json=rawData,proto3" json:"raw_data,omitempty"` // Data can be stored inside the protobuf file using type-specific fields or raw_data. // Alternatively, raw bytes data can be stored in an external file, using the external_data field. // external_data stores key-value pairs describing data location. Recognized keys are: // - "location" (required) - POSIX filesystem path relative to the directory where the ONNX // protobuf model was stored // - "offset" (optional) - position of byte at which stored data begins. Integer stored as string. // Offset values SHOULD be multiples 4096 (page size) to enable mmap support. // - "length" (optional) - number of bytes containing data. Integer stored as string. // - "checksum" (optional) - SHA1 digest of file specified in under 'location' key. ExternalData []*StringStringEntryProto `protobuf:"bytes,13,rep,name=external_data,json=externalData,proto3" json:"external_data,omitempty"` // If value not set, data is stored in raw_data (if set) otherwise in type-specified field. DataLocation TensorProto_DataLocation `` /* 134-byte string literal not displayed */ // For double // Complex128 tensors are encoded as a single array of doubles, // with the real components appearing in odd numbered positions, // and the corresponding imaginary component appearing in the // subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] // is encoded as [1.0, 2.0 ,3.0 ,4.0] // When this field is present, the data_type field MUST be DOUBLE or COMPLEX128 DoubleData []float64 `protobuf:"fixed64,10,rep,packed,name=double_data,json=doubleData,proto3" json:"double_data,omitempty"` // For uint64 and uint32 values // When this field is present, the data_type field MUST be // UINT32 or UINT64 Uint64Data []uint64 `protobuf:"varint,11,rep,packed,name=uint64_data,json=uint64Data,proto3" json:"uint64_data,omitempty"` // contains filtered or unexported fields }
Tensors
A serialized tensor value.
func (*TensorProto) Descriptor
deprecated
func (*TensorProto) Descriptor() ([]byte, []int)
Deprecated: Use TensorProto.ProtoReflect.Descriptor instead.
func (*TensorProto) GetDataLocation ¶
func (x *TensorProto) GetDataLocation() TensorProto_DataLocation
func (*TensorProto) GetDataType ¶
func (x *TensorProto) GetDataType() int32
func (*TensorProto) GetDims ¶
func (x *TensorProto) GetDims() []int64
func (*TensorProto) GetDocString ¶
func (x *TensorProto) GetDocString() string
func (*TensorProto) GetDoubleData ¶
func (x *TensorProto) GetDoubleData() []float64
func (*TensorProto) GetExternalData ¶
func (x *TensorProto) GetExternalData() []*StringStringEntryProto
func (*TensorProto) GetFloatData ¶
func (x *TensorProto) GetFloatData() []float32
func (*TensorProto) GetInt32Data ¶
func (x *TensorProto) GetInt32Data() []int32
func (*TensorProto) GetInt64Data ¶
func (x *TensorProto) GetInt64Data() []int64
func (*TensorProto) GetName ¶
func (x *TensorProto) GetName() string
func (*TensorProto) GetRawData ¶
func (x *TensorProto) GetRawData() []byte
func (*TensorProto) GetSegment ¶
func (x *TensorProto) GetSegment() *TensorProto_Segment
func (*TensorProto) GetStringData ¶
func (x *TensorProto) GetStringData() [][]byte
func (*TensorProto) GetUint64Data ¶
func (x *TensorProto) GetUint64Data() []uint64
func (*TensorProto) ProtoMessage ¶
func (*TensorProto) ProtoMessage()
func (*TensorProto) ProtoReflect ¶
func (x *TensorProto) ProtoReflect() protoreflect.Message
func (*TensorProto) Reset ¶
func (x *TensorProto) Reset()
func (*TensorProto) String ¶
func (x *TensorProto) String() string
type TensorProto_DataLocation ¶
type TensorProto_DataLocation int32
Location of the data for this tensor. MUST be one of: - DEFAULT - data stored inside the protobuf message. Data is stored in raw_data (if set) otherwise in type-specified field. - EXTERNAL - data stored in an external location as described by external_data field.
const ( TensorProto_DEFAULT TensorProto_DataLocation = 0 TensorProto_EXTERNAL TensorProto_DataLocation = 1 )
func (TensorProto_DataLocation) Descriptor ¶
func (TensorProto_DataLocation) Descriptor() protoreflect.EnumDescriptor
func (TensorProto_DataLocation) Enum ¶
func (x TensorProto_DataLocation) Enum() *TensorProto_DataLocation
func (TensorProto_DataLocation) EnumDescriptor
deprecated
func (TensorProto_DataLocation) EnumDescriptor() ([]byte, []int)
Deprecated: Use TensorProto_DataLocation.Descriptor instead.
func (TensorProto_DataLocation) Number ¶
func (x TensorProto_DataLocation) Number() protoreflect.EnumNumber
func (TensorProto_DataLocation) String ¶
func (x TensorProto_DataLocation) String() string
func (TensorProto_DataLocation) Type ¶
func (TensorProto_DataLocation) Type() protoreflect.EnumType
type TensorProto_DataType ¶
type TensorProto_DataType int32
const ( TensorProto_UNDEFINED TensorProto_DataType = 0 // Basic types. TensorProto_FLOAT TensorProto_DataType = 1 // float TensorProto_UINT8 TensorProto_DataType = 2 // uint8_t TensorProto_INT8 TensorProto_DataType = 3 // int8_t TensorProto_UINT16 TensorProto_DataType = 4 // uint16_t TensorProto_INT16 TensorProto_DataType = 5 // int16_t TensorProto_INT32 TensorProto_DataType = 6 // int32_t TensorProto_INT64 TensorProto_DataType = 7 // int64_t TensorProto_STRING TensorProto_DataType = 8 // string TensorProto_BOOL TensorProto_DataType = 9 // bool // IEEE754 half-precision floating-point format (16 bits wide). // This format has 1 sign bit, 5 exponent bits, and 10 mantissa bits. TensorProto_FLOAT16 TensorProto_DataType = 10 TensorProto_DOUBLE TensorProto_DataType = 11 TensorProto_UINT32 TensorProto_DataType = 12 TensorProto_UINT64 TensorProto_DataType = 13 TensorProto_COMPLEX64 TensorProto_DataType = 14 // complex with float32 real and imaginary components TensorProto_COMPLEX128 TensorProto_DataType = 15 // complex with float64 real and imaginary components // Non-IEEE floating-point format based on IEEE754 single-precision // floating-point number truncated to 16 bits. // This format has 1 sign bit, 8 exponent bits, and 7 mantissa bits. TensorProto_BFLOAT16 TensorProto_DataType = 16 )
func (TensorProto_DataType) Descriptor ¶
func (TensorProto_DataType) Descriptor() protoreflect.EnumDescriptor
func (TensorProto_DataType) Enum ¶
func (x TensorProto_DataType) Enum() *TensorProto_DataType
func (TensorProto_DataType) EnumDescriptor
deprecated
func (TensorProto_DataType) EnumDescriptor() ([]byte, []int)
Deprecated: Use TensorProto_DataType.Descriptor instead.
func (TensorProto_DataType) Number ¶
func (x TensorProto_DataType) Number() protoreflect.EnumNumber
func (TensorProto_DataType) String ¶
func (x TensorProto_DataType) String() string
func (TensorProto_DataType) Type ¶
func (TensorProto_DataType) Type() protoreflect.EnumType
type TensorProto_Segment ¶
type TensorProto_Segment struct { Begin int64 `protobuf:"varint,1,opt,name=begin,proto3" json:"begin,omitempty"` End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` // contains filtered or unexported fields }
For very large tensors, we may want to store them in chunks, in which case the following fields will specify the segment that is stored in the current TensorProto.
func (*TensorProto_Segment) Descriptor
deprecated
func (*TensorProto_Segment) Descriptor() ([]byte, []int)
Deprecated: Use TensorProto_Segment.ProtoReflect.Descriptor instead.
func (*TensorProto_Segment) GetBegin ¶
func (x *TensorProto_Segment) GetBegin() int64
func (*TensorProto_Segment) GetEnd ¶
func (x *TensorProto_Segment) GetEnd() int64
func (*TensorProto_Segment) ProtoMessage ¶
func (*TensorProto_Segment) ProtoMessage()
func (*TensorProto_Segment) ProtoReflect ¶
func (x *TensorProto_Segment) ProtoReflect() protoreflect.Message
func (*TensorProto_Segment) Reset ¶
func (x *TensorProto_Segment) Reset()
func (*TensorProto_Segment) String ¶
func (x *TensorProto_Segment) String() string
type TensorShapeProto ¶
type TensorShapeProto struct { Dim []*TensorShapeProto_Dimension `protobuf:"bytes,1,rep,name=dim,proto3" json:"dim,omitempty"` // contains filtered or unexported fields }
Defines a tensor shape. A dimension can be either an integer value or a symbolic variable. A symbolic variable represents an unknown dimension.
func (*TensorShapeProto) Descriptor
deprecated
func (*TensorShapeProto) Descriptor() ([]byte, []int)
Deprecated: Use TensorShapeProto.ProtoReflect.Descriptor instead.
func (*TensorShapeProto) GetDim ¶
func (x *TensorShapeProto) GetDim() []*TensorShapeProto_Dimension
func (*TensorShapeProto) ProtoMessage ¶
func (*TensorShapeProto) ProtoMessage()
func (*TensorShapeProto) ProtoReflect ¶
func (x *TensorShapeProto) ProtoReflect() protoreflect.Message
func (*TensorShapeProto) Reset ¶
func (x *TensorShapeProto) Reset()
func (*TensorShapeProto) String ¶
func (x *TensorShapeProto) String() string
type TensorShapeProto_Dimension ¶
type TensorShapeProto_Dimension struct { // Types that are assignable to Value: // *TensorShapeProto_Dimension_DimValue // *TensorShapeProto_Dimension_DimParam Value isTensorShapeProto_Dimension_Value `protobuf_oneof:"value"` // Standard denotation can optionally be used to denote tensor // dimensions with standard semantic descriptions to ensure // that operations are applied to the correct axis of a tensor. // Refer to https://github.com/onnx/onnx/blob/master/docs/DimensionDenotation.md#denotation-definition // for pre-defined dimension denotations. Denotation string `protobuf:"bytes,3,opt,name=denotation,proto3" json:"denotation,omitempty"` // contains filtered or unexported fields }
func (*TensorShapeProto_Dimension) Descriptor
deprecated
func (*TensorShapeProto_Dimension) Descriptor() ([]byte, []int)
Deprecated: Use TensorShapeProto_Dimension.ProtoReflect.Descriptor instead.
func (*TensorShapeProto_Dimension) GetDenotation ¶
func (x *TensorShapeProto_Dimension) GetDenotation() string
func (*TensorShapeProto_Dimension) GetDimParam ¶
func (x *TensorShapeProto_Dimension) GetDimParam() string
func (*TensorShapeProto_Dimension) GetDimValue ¶
func (x *TensorShapeProto_Dimension) GetDimValue() int64
func (*TensorShapeProto_Dimension) GetValue ¶
func (m *TensorShapeProto_Dimension) GetValue() isTensorShapeProto_Dimension_Value
func (*TensorShapeProto_Dimension) ProtoMessage ¶
func (*TensorShapeProto_Dimension) ProtoMessage()
func (*TensorShapeProto_Dimension) ProtoReflect ¶
func (x *TensorShapeProto_Dimension) ProtoReflect() protoreflect.Message
func (*TensorShapeProto_Dimension) Reset ¶
func (x *TensorShapeProto_Dimension) Reset()
func (*TensorShapeProto_Dimension) String ¶
func (x *TensorShapeProto_Dimension) String() string
type TensorShapeProto_Dimension_DimParam ¶
type TensorShapeProto_Dimension_DimParam struct {
DimParam string `protobuf:"bytes,2,opt,name=dim_param,json=dimParam,proto3,oneof"` // namespace Shape
}
type TensorShapeProto_Dimension_DimValue ¶
type TensorShapeProto_Dimension_DimValue struct {
DimValue int64 `protobuf:"varint,1,opt,name=dim_value,json=dimValue,proto3,oneof"`
}
type TrainingInfoProto ¶
type TrainingInfoProto struct { // This field describes a graph to compute the initial tensors // upon starting the training process. Initialization graph has no input // and can have multiple outputs. Usually, trainable tensors in neural // networks are randomly initialized. To achieve that, for each tensor, // the user can put a random number operator such as RandomNormal or // RandomUniform in TrainingInfoProto.initialization.node and assign its // random output to the specific tensor using "initialization_binding". // This graph can also set the initializers in "algorithm" in the same // TrainingInfoProto; a use case is resetting the number of training // iteration to zero. // // By default, this field is an empty graph and its evaluation does not // produce any output. Thus, no initializer would be changed by default. Initialization *GraphProto `protobuf:"bytes,1,opt,name=initialization,proto3" json:"initialization,omitempty"` // This field represents a training algorithm step. Given required inputs, // it computes outputs to update initializers in its own or inference graph's // initializer lists. In general, this field contains loss node, gradient node, // optimizer node, increment of iteration count. // // An execution of the training algorithm step is performed by executing the // graph obtained by combining the inference graph (namely "ModelProto.graph") // and the "algorithm" graph. That is, the actual the actual // input/initializer/output/node/value_info/sparse_initializer list of // the training graph is the concatenation of // "ModelProto.graph.input/initializer/output/node/value_info/sparse_initializer" // and "algorithm.input/initializer/output/node/value_info/sparse_initializer" // in that order. This combined graph must satisfy the normal ONNX conditions. // Now, let's provide a visualization of graph combination for clarity. // Let the inference graph (i.e., "ModelProto.graph") be // tensor_a, tensor_b -> MatMul -> tensor_c -> Sigmoid -> tensor_d // and the "algorithm" graph be // tensor_d -> Add -> tensor_e // The combination process results // tensor_a, tensor_b -> MatMul -> tensor_c -> Sigmoid -> tensor_d -> Add -> tensor_e // // Notice that an input of a node in the "algorithm" graph may reference the // output of a node in the inference graph (but not the other way round). Also, inference // node cannot reference inputs of "algorithm". With these restrictions, inference graph // can always be run independently without training information. // // By default, this field is an empty graph and its evaluation does not // produce any output. Evaluating the default training step never // update any initializers. Algorithm *GraphProto `protobuf:"bytes,2,opt,name=algorithm,proto3" json:"algorithm,omitempty"` // This field specifies the bindings from the outputs of "initialization" to // some initializers in "ModelProto.graph.initializer" and // the "algorithm.initializer" in the same TrainingInfoProto. // See "update_binding" below for details. // // By default, this field is empty and no initializer would be changed // by the execution of "initialization". InitializationBinding []*StringStringEntryProto `protobuf:"bytes,3,rep,name=initialization_binding,json=initializationBinding,proto3" json:"initialization_binding,omitempty"` // Gradient-based training is usually an iterative procedure. In one gradient // descent iteration, we apply // // x = x - r * g // // where "x" is the optimized tensor, "r" stands for learning rate, and "g" is // gradient of "x" with respect to a chosen loss. To avoid adding assignments // into the training graph, we split the update equation into // // y = x - r * g // x = y // // The user needs to save "y = x - r * g" into TrainingInfoProto.algorithm. To // tell that "y" should be assigned to "x", the field "update_binding" may // contain a key-value pair of strings, "x" (key of StringStringEntryProto) // and "y" (value of StringStringEntryProto). // For a neural network with multiple trainable (mutable) tensors, there can // be multiple key-value pairs in "update_binding". // // The initializers appears as keys in "update_binding" are considered // mutable variables. This implies some behaviors // as described below. // // 1. We have only unique keys in all "update_binding"s so that two // variables may not have the same name. This ensures that one // variable is assigned up to once. // 2. The keys must appear in names of "ModelProto.graph.initializer" or // "TrainingInfoProto.algorithm.initializer". // 3. The values must be output names of "algorithm" or "ModelProto.graph.output". // 4. Mutable variables are initialized to the value specified by the // corresponding initializer, and then potentially updated by // "initializer_binding"s and "update_binding"s in "TrainingInfoProto"s. // // This field usually contains names of trainable tensors // (in ModelProto.graph), optimizer states such as momentums in advanced // stochastic gradient methods (in TrainingInfoProto.graph), // and number of training iterations (in TrainingInfoProto.graph). // // By default, this field is empty and no initializer would be changed // by the execution of "algorithm". UpdateBinding []*StringStringEntryProto `protobuf:"bytes,4,rep,name=update_binding,json=updateBinding,proto3" json:"update_binding,omitempty"` // contains filtered or unexported fields }
Training information TrainingInfoProto stores information for training a model. In particular, this defines two functionalities: an initialization-step and a training-algorithm-step. Initialization resets the model back to its original state as if no training has been performed. Training algorithm improves the model based on input data.
The semantics of the initialization-step is that the initializers in ModelProto.graph and in TrainingInfoProto.algorithm are first initialized as specified by the initializers in the graph, and then updated by the "initialization_binding" in every instance in ModelProto.training_info.
The field "algorithm" defines a computation graph which represents a training algorithm's step. After the execution of a TrainingInfoProto.algorithm, the initializers specified by "update_binding" may be immediately updated. If the targeted training algorithm contains consecutive update steps (such as block coordinate descent methods), the user needs to create a TrainingInfoProto for each step.
func (*TrainingInfoProto) Descriptor
deprecated
func (*TrainingInfoProto) Descriptor() ([]byte, []int)
Deprecated: Use TrainingInfoProto.ProtoReflect.Descriptor instead.
func (*TrainingInfoProto) GetAlgorithm ¶
func (x *TrainingInfoProto) GetAlgorithm() *GraphProto
func (*TrainingInfoProto) GetInitialization ¶
func (x *TrainingInfoProto) GetInitialization() *GraphProto
func (*TrainingInfoProto) GetInitializationBinding ¶
func (x *TrainingInfoProto) GetInitializationBinding() []*StringStringEntryProto
func (*TrainingInfoProto) GetUpdateBinding ¶
func (x *TrainingInfoProto) GetUpdateBinding() []*StringStringEntryProto
func (*TrainingInfoProto) ProtoMessage ¶
func (*TrainingInfoProto) ProtoMessage()
func (*TrainingInfoProto) ProtoReflect ¶
func (x *TrainingInfoProto) ProtoReflect() protoreflect.Message
func (*TrainingInfoProto) Reset ¶
func (x *TrainingInfoProto) Reset()
func (*TrainingInfoProto) String ¶
func (x *TrainingInfoProto) String() string
type TypeProto ¶
type TypeProto struct { // Types that are assignable to Value: // *TypeProto_TensorType // *TypeProto_SequenceType // *TypeProto_MapType // *TypeProto_OptionalType // *TypeProto_SparseTensorType Value isTypeProto_Value `protobuf_oneof:"value"` // An optional denotation can be used to denote the whole // type with a standard semantic description as to what is // stored inside. Refer to https://github.com/onnx/onnx/blob/master/docs/TypeDenotation.md#type-denotation-definition // for pre-defined type denotations. Denotation string `protobuf:"bytes,6,opt,name=denotation,proto3" json:"denotation,omitempty"` // contains filtered or unexported fields }
Types
The standard ONNX data types.
func (*TypeProto) Descriptor
deprecated
func (*TypeProto) GetDenotation ¶
func (*TypeProto) GetMapType ¶
func (x *TypeProto) GetMapType() *TypeProto_Map
func (*TypeProto) GetOptionalType ¶
func (x *TypeProto) GetOptionalType() *TypeProto_Optional
func (*TypeProto) GetSequenceType ¶
func (x *TypeProto) GetSequenceType() *TypeProto_Sequence
func (*TypeProto) GetSparseTensorType ¶
func (x *TypeProto) GetSparseTensorType() *TypeProto_SparseTensor
func (*TypeProto) GetTensorType ¶
func (x *TypeProto) GetTensorType() *TypeProto_Tensor
func (*TypeProto) ProtoMessage ¶
func (*TypeProto) ProtoMessage()
func (*TypeProto) ProtoReflect ¶
func (x *TypeProto) ProtoReflect() protoreflect.Message
type TypeProto_Map ¶
type TypeProto_Map struct { // This field MUST have a valid TensorProto.DataType value // This field MUST be present for this version of the IR. // This field MUST refer to an integral type ([U]INT{8|16|32|64}) or STRING KeyType int32 `protobuf:"varint,1,opt,name=key_type,json=keyType,proto3" json:"key_type,omitempty"` // This field MUST be present for this version of the IR. ValueType *TypeProto `protobuf:"bytes,2,opt,name=value_type,json=valueType,proto3" json:"value_type,omitempty"` // contains filtered or unexported fields }
map<K,V>
func (*TypeProto_Map) Descriptor
deprecated
func (*TypeProto_Map) Descriptor() ([]byte, []int)
Deprecated: Use TypeProto_Map.ProtoReflect.Descriptor instead.
func (*TypeProto_Map) GetKeyType ¶
func (x *TypeProto_Map) GetKeyType() int32
func (*TypeProto_Map) GetValueType ¶
func (x *TypeProto_Map) GetValueType() *TypeProto
func (*TypeProto_Map) ProtoMessage ¶
func (*TypeProto_Map) ProtoMessage()
func (*TypeProto_Map) ProtoReflect ¶
func (x *TypeProto_Map) ProtoReflect() protoreflect.Message
func (*TypeProto_Map) Reset ¶
func (x *TypeProto_Map) Reset()
func (*TypeProto_Map) String ¶
func (x *TypeProto_Map) String() string
type TypeProto_MapType ¶
type TypeProto_MapType struct { // The type of a map. MapType *TypeProto_Map `protobuf:"bytes,5,opt,name=map_type,json=mapType,proto3,oneof"` }
type TypeProto_Optional ¶
type TypeProto_Optional struct { // The type and optional shape of the element wrapped. // This field MUST be present for this version of the IR. // Possible values correspond to OptionalProto.DataType enum ElemType *TypeProto `protobuf:"bytes,1,opt,name=elem_type,json=elemType,proto3" json:"elem_type,omitempty"` // contains filtered or unexported fields }
wrapper for Tensor, Sequence, or Map
func (*TypeProto_Optional) Descriptor
deprecated
func (*TypeProto_Optional) Descriptor() ([]byte, []int)
Deprecated: Use TypeProto_Optional.ProtoReflect.Descriptor instead.
func (*TypeProto_Optional) GetElemType ¶
func (x *TypeProto_Optional) GetElemType() *TypeProto
func (*TypeProto_Optional) ProtoMessage ¶
func (*TypeProto_Optional) ProtoMessage()
func (*TypeProto_Optional) ProtoReflect ¶
func (x *TypeProto_Optional) ProtoReflect() protoreflect.Message
func (*TypeProto_Optional) Reset ¶
func (x *TypeProto_Optional) Reset()
func (*TypeProto_Optional) String ¶
func (x *TypeProto_Optional) String() string
type TypeProto_OptionalType ¶
type TypeProto_OptionalType struct { // The type of an optional. OptionalType *TypeProto_Optional `protobuf:"bytes,9,opt,name=optional_type,json=optionalType,proto3,oneof"` }
type TypeProto_Sequence ¶
type TypeProto_Sequence struct { // The type and optional shape of each element of the sequence. // This field MUST be present for this version of the IR. ElemType *TypeProto `protobuf:"bytes,1,opt,name=elem_type,json=elemType,proto3" json:"elem_type,omitempty"` // contains filtered or unexported fields }
repeated T
func (*TypeProto_Sequence) Descriptor
deprecated
func (*TypeProto_Sequence) Descriptor() ([]byte, []int)
Deprecated: Use TypeProto_Sequence.ProtoReflect.Descriptor instead.
func (*TypeProto_Sequence) GetElemType ¶
func (x *TypeProto_Sequence) GetElemType() *TypeProto
func (*TypeProto_Sequence) ProtoMessage ¶
func (*TypeProto_Sequence) ProtoMessage()
func (*TypeProto_Sequence) ProtoReflect ¶
func (x *TypeProto_Sequence) ProtoReflect() protoreflect.Message
func (*TypeProto_Sequence) Reset ¶
func (x *TypeProto_Sequence) Reset()
func (*TypeProto_Sequence) String ¶
func (x *TypeProto_Sequence) String() string
type TypeProto_SequenceType ¶
type TypeProto_SequenceType struct { // The type of a sequence. SequenceType *TypeProto_Sequence `protobuf:"bytes,4,opt,name=sequence_type,json=sequenceType,proto3,oneof"` }
type TypeProto_SparseTensor ¶
type TypeProto_SparseTensor struct { // This field MUST NOT have the value of UNDEFINED // This field MUST have a valid TensorProto.DataType value // This field MUST be present for this version of the IR. ElemType int32 `protobuf:"varint,1,opt,name=elem_type,json=elemType,proto3" json:"elem_type,omitempty"` Shape *TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` // contains filtered or unexported fields }
func (*TypeProto_SparseTensor) Descriptor
deprecated
func (*TypeProto_SparseTensor) Descriptor() ([]byte, []int)
Deprecated: Use TypeProto_SparseTensor.ProtoReflect.Descriptor instead.
func (*TypeProto_SparseTensor) GetElemType ¶
func (x *TypeProto_SparseTensor) GetElemType() int32
func (*TypeProto_SparseTensor) GetShape ¶
func (x *TypeProto_SparseTensor) GetShape() *TensorShapeProto
func (*TypeProto_SparseTensor) ProtoMessage ¶
func (*TypeProto_SparseTensor) ProtoMessage()
func (*TypeProto_SparseTensor) ProtoReflect ¶
func (x *TypeProto_SparseTensor) ProtoReflect() protoreflect.Message
func (*TypeProto_SparseTensor) Reset ¶
func (x *TypeProto_SparseTensor) Reset()
func (*TypeProto_SparseTensor) String ¶
func (x *TypeProto_SparseTensor) String() string
type TypeProto_SparseTensorType ¶
type TypeProto_SparseTensorType struct { // Type of the sparse tensor SparseTensorType *TypeProto_SparseTensor `protobuf:"bytes,8,opt,name=sparse_tensor_type,json=sparseTensorType,proto3,oneof"` }
type TypeProto_Tensor ¶
type TypeProto_Tensor struct { // This field MUST NOT have the value of UNDEFINED // This field MUST have a valid TensorProto.DataType value // This field MUST be present for this version of the IR. ElemType int32 `protobuf:"varint,1,opt,name=elem_type,json=elemType,proto3" json:"elem_type,omitempty"` Shape *TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` // contains filtered or unexported fields }
func (*TypeProto_Tensor) Descriptor
deprecated
func (*TypeProto_Tensor) Descriptor() ([]byte, []int)
Deprecated: Use TypeProto_Tensor.ProtoReflect.Descriptor instead.
func (*TypeProto_Tensor) GetElemType ¶
func (x *TypeProto_Tensor) GetElemType() int32
func (*TypeProto_Tensor) GetShape ¶
func (x *TypeProto_Tensor) GetShape() *TensorShapeProto
func (*TypeProto_Tensor) ProtoMessage ¶
func (*TypeProto_Tensor) ProtoMessage()
func (*TypeProto_Tensor) ProtoReflect ¶
func (x *TypeProto_Tensor) ProtoReflect() protoreflect.Message
func (*TypeProto_Tensor) Reset ¶
func (x *TypeProto_Tensor) Reset()
func (*TypeProto_Tensor) String ¶
func (x *TypeProto_Tensor) String() string
type TypeProto_TensorType ¶
type TypeProto_TensorType struct { // The type of a tensor. TensorType *TypeProto_Tensor `protobuf:"bytes,1,opt,name=tensor_type,json=tensorType,proto3,oneof"` }
type ValueInfoProto ¶
type ValueInfoProto struct { // This field MUST be present in this version of the IR. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // namespace Value // This field MUST be present in this version of the IR for // inputs and outputs of the top-level graph. Type *TypeProto `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // A human-readable documentation for this value. Markdown is allowed. DocString string `protobuf:"bytes,3,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` // contains filtered or unexported fields }
Defines information on value, including the name, the type, and the shape of the value.
func (*ValueInfoProto) Descriptor
deprecated
func (*ValueInfoProto) Descriptor() ([]byte, []int)
Deprecated: Use ValueInfoProto.ProtoReflect.Descriptor instead.
func (*ValueInfoProto) GetDocString ¶
func (x *ValueInfoProto) GetDocString() string
func (*ValueInfoProto) GetName ¶
func (x *ValueInfoProto) GetName() string
func (*ValueInfoProto) GetType ¶
func (x *ValueInfoProto) GetType() *TypeProto
func (*ValueInfoProto) ProtoMessage ¶
func (*ValueInfoProto) ProtoMessage()
func (*ValueInfoProto) ProtoReflect ¶
func (x *ValueInfoProto) ProtoReflect() protoreflect.Message
func (*ValueInfoProto) Reset ¶
func (x *ValueInfoProto) Reset()
func (*ValueInfoProto) String ¶
func (x *ValueInfoProto) String() string
type Version ¶
type Version int32
Versioning
ONNX versioning is specified in docs/IR.md and elaborated on in docs/Versioning.md
To be compatible with both proto2 and proto3, we will use a version number that is not defined by the default value but an explicit enum number.
const ( // proto3 requires the first enum value to be zero. // We add this just to appease the compiler. Version__START_VERSION Version = 0 // The version field is always serialized and we will use it to store the // version that the graph is generated from. This helps us set up version // control. // For the IR, we are using simple numbers starting with 0x00000001, // which was the version we published on Oct 10, 2017. Version_IR_VERSION_2017_10_10 Version = 1 // IR_VERSION 2 published on Oct 30, 2017 // - Added type discriminator to AttributeProto to support proto3 users Version_IR_VERSION_2017_10_30 Version = 2 // IR VERSION 3 published on Nov 3, 2017 // - For operator versioning: // - Added new message OperatorSetIdProto // - Added opset_import in ModelProto // - For vendor extensions, added domain in NodeProto Version_IR_VERSION_2017_11_3 Version = 3 // IR VERSION 4 published on Jan 22, 2019 // - Relax constraint that initializers should be a subset of graph inputs // - Add type BFLOAT16 Version_IR_VERSION_2019_1_22 Version = 4 // IR VERSION 5 published on March 18, 2019 // - Add message TensorAnnotation. // - Add quantization annotation in GraphProto to map tensor with its scale and zero point quantization parameters. Version_IR_VERSION_2019_3_18 Version = 5 // IR VERSION 6 published on Sep 19, 2019 // - Add support for sparse tensor constants stored in model. // - Add message SparseTensorProto // - Add sparse initializers Version_IR_VERSION_2019_9_19 Version = 6 // IR VERSION 7 published on May 8, 2020 // - Add support to allow function body graph to rely on multiple external opreator sets. // - Add a list to promote inference graph's initializers to global and // mutable variables. Global variables are visible in all graphs of the // stored models. // - Add message TrainingInfoProto to store initialization // method and training algorithm. The execution of TrainingInfoProto // can modify the values of mutable variables. // - Implicitly add inference graph into each TrainingInfoProto's algorithm. Version_IR_VERSION_2020_5_8 Version = 7 // IR VERSION 8 published on <TBD> // Introduce TypeProto.SparseTensor // Introduce TypeProto.Optional // Added a list of FunctionProtos local to the model // Deprecated since_version and operator status from FunctionProto Version_IR_VERSION Version = 8 )
func (Version) Descriptor ¶
func (Version) Descriptor() protoreflect.EnumDescriptor
func (Version) EnumDescriptor
deprecated
func (Version) Number ¶
func (x Version) Number() protoreflect.EnumNumber
func (Version) Type ¶
func (Version) Type() protoreflect.EnumType