Versions in this module Expand all Collapse all v1 v1.13.1 Mar 31, 2025 Changes in this version + const ExecutionModeParallel + const ExecutionModeSequential + const GraphOptimizationLevelDisableAll + const GraphOptimizationLevelEnableAll + const GraphOptimizationLevelEnableBasic + const GraphOptimizationLevelEnableExtended + const ONNXTypeMap + const ONNXTypeOpaque + const ONNXTypeOptional + const ONNXTypeSequence + const ONNXTypeSparseTensor + const ONNXTypeTensor + const ONNXTypeUnknown + const TensorElementDataTypeBFloat16 + const TensorElementDataTypeBool + const TensorElementDataTypeComplex128 + const TensorElementDataTypeComplex64 + const TensorElementDataTypeDouble + const TensorElementDataTypeFloat + const TensorElementDataTypeFloat16 + const TensorElementDataTypeFloat8E4M3FN + const TensorElementDataTypeFloat8E4M3FNUZ + const TensorElementDataTypeFloat8E5M2 + const TensorElementDataTypeFloat8E5M2FNUZ + const TensorElementDataTypeInt16 + const TensorElementDataTypeInt32 + const TensorElementDataTypeInt4 + const TensorElementDataTypeInt64 + const TensorElementDataTypeInt8 + const TensorElementDataTypeString + const TensorElementDataTypeUint16 + const TensorElementDataTypeUint32 + const TensorElementDataTypeUint4 + const TensorElementDataTypeUint64 + const TensorElementDataTypeUint8 + const TensorElementDataTypeUndefined + var NotInitializedError error = fmt.Errorf(...) + var ShapeOverflowError error = fmt.Errorf(...) + var TrainingAPIRemovedError error = fmt.Errorf(...) + var ZeroShapeLengthError error = fmt.Errorf("The shape has no dimensions") + func DestroyEnvironment() error + func DisableTelemetry() error + func EnableTelemetry() error + func GetInputOutputInfo(path string) ([]InputOutputInfo, []InputOutputInfo, error) + func GetInputOutputInfoWithONNXData(data []byte) ([]InputOutputInfo, []InputOutputInfo, error) + func GetTensorElementDataType[T TensorData]() C.ONNXTensorElementDataType + func GetVersion() string + func InitializeEnvironment(opts ...EnvironmentOption) error + func IsInitialized() bool + func IsTrainingSupported() bool + func SetSharedLibraryPath(path string) + type AdvancedSession struct + func NewAdvancedSession(onnxFilePath string, inputNames, outputNames []string, inputs, outputs []Value, ...) (*AdvancedSession, error) + func NewAdvancedSessionWithONNXData(onnxData []byte, inputNames, outputNames []string, inputs, outputs []Value, ...) (*AdvancedSession, error) + func (s *AdvancedSession) Destroy() error + func (s *AdvancedSession) GetModelMetadata() (*ModelMetadata, error) + func (s *AdvancedSession) Run() error + type ArbitraryTensor = Value + type BadShapeDimensionError struct + DimensionIndex int + DimensionSize int64 + func (e *BadShapeDimensionError) Error() string + type CUDAProviderOptions struct + func NewCUDAProviderOptions() (*CUDAProviderOptions, error) + func (o *CUDAProviderOptions) Destroy() error + func (o *CUDAProviderOptions) Update(options map[string]string) error + type CustomDataTensor struct + func NewCustomDataTensor(s Shape, data []byte, dataType TensorElementDataType) (*CustomDataTensor, error) + func (t *CustomDataTensor) DataType() C.ONNXTensorElementDataType + func (t *CustomDataTensor) Destroy() error + func (t *CustomDataTensor) GetData() []byte + func (t *CustomDataTensor) GetInternals() *ValueInternalData + func (t *CustomDataTensor) GetONNXType() ONNXType + func (t *CustomDataTensor) GetShape() Shape + func (t *CustomDataTensor) ZeroContents() + type DynamicAdvancedSession struct + func NewDynamicAdvancedSession(onnxFilePath string, inputNames, outputNames []string, options *SessionOptions) (*DynamicAdvancedSession, error) + func NewDynamicAdvancedSessionWithONNXData(onnxData []byte, inputNames, outputNames []string, options *SessionOptions) (*DynamicAdvancedSession, error) + func (s *DynamicAdvancedSession) CreateIoBinding() (*IoBinding, error) + func (s *DynamicAdvancedSession) Destroy() error + func (s *DynamicAdvancedSession) GetModelMetadata() (*ModelMetadata, error) + func (s *DynamicAdvancedSession) Run(inputs, outputs []Value) error + func (s *DynamicAdvancedSession) RunWithBinding(b *IoBinding) error + type DynamicSession struct + func NewDynamicSessionWithONNXData[in TensorData, out TensorData](onnxData []byte, inputNames, outputNames []string) (*DynamicSession[in, out], error) + func NewDynamicSession[in TensorData, out TensorData](onnxFilePath string, inputNames, outputNames []string) (*DynamicSession[in, out], error) + func (s *DynamicSession[_, _]) Destroy() error + func (s *DynamicSession[in, out]) Run(inputs []*Tensor[in], outputs []*Tensor[out]) error + type EnvironmentOption func(*C.OrtEnv) *C.OrtStatus + func WithLogLevelError() EnvironmentOption + func WithLogLevelFatal() EnvironmentOption + func WithLogLevelInfo() EnvironmentOption + func WithLogLevelVerbose() EnvironmentOption + func WithLogLevelWarning() EnvironmentOption + type ExecutionMode int + func (m ExecutionMode) String() string + type FloatData interface + type GraphOptimizationLevel int + func (l GraphOptimizationLevel) String() string + type InputOutputInfo struct + DataType TensorElementDataType + Dimensions Shape + Name string + OrtValueType ONNXType + func (n *InputOutputInfo) String() string + type IntData interface + type IoBinding struct + func (b *IoBinding) BindInput(name string, value Value) error + func (b *IoBinding) BindOutput(name string, value Value) error + func (b *IoBinding) ClearBoundInputs() + func (b *IoBinding) ClearBoundOutputs() + func (b *IoBinding) Destroy() error + func (b *IoBinding) GetBoundOutputNames() ([]string, error) + func (b *IoBinding) GetBoundOutputValues() ([]Value, error) + type Map struct + func NewMap(keys, values Value) (*Map, error) + func NewMapFromGoMap[K, V TensorData](m map[K]V) (*Map, error) + func (m *Map) DataType() C.ONNXTensorElementDataType + func (m *Map) Destroy() error + func (m *Map) GetInternals() *ValueInternalData + func (m *Map) GetKeysAndValues() (Value, Value, error) + func (m *Map) GetONNXType() ONNXType + func (m *Map) GetShape() Shape + func (m *Map) ZeroContents() + type ModelMetadata struct + func GetModelMetadata(path string) (*ModelMetadata, error) + func GetModelMetadataWithONNXData(data []byte) (*ModelMetadata, error) + func (m *ModelMetadata) Destroy() error + func (m *ModelMetadata) GetCustomMetadataMapKeys() ([]string, error) + func (m *ModelMetadata) GetDescription() (string, error) + func (m *ModelMetadata) GetDomain() (string, error) + func (m *ModelMetadata) GetGraphName() (string, error) + func (m *ModelMetadata) GetProducerName() (string, error) + func (m *ModelMetadata) GetVersion() (int64, error) + func (m *ModelMetadata) LookupCustomMetadataMap(key string) (string, bool, error) + type ONNXType int + func (t ONNXType) String() string + type Scalar struct + func NewEmptyScalar[T TensorData]() (*Scalar[T], error) + func NewScalar[T TensorData](data T) (*Scalar[T], error) + func (s *Scalar[T]) Destroy() error + func (s *Scalar[T]) GetShape() Shape + func (s *Scalar[T]) ZeroContents() + func (t *Scalar[T]) DataType() C.ONNXTensorElementDataType + func (t *Scalar[T]) GetData() T + func (t *Scalar[T]) Set(value T) + func (t *Scalar[_]) GetInternals() *ValueInternalData + func (t *Scalar[_]) GetONNXType() ONNXType + type Sequence struct + func NewSequence(contents []Value) (*Sequence, error) + func (s *Sequence) DataType() C.ONNXTensorElementDataType + func (s *Sequence) Destroy() error + func (s *Sequence) GetInternals() *ValueInternalData + func (s *Sequence) GetONNXType() ONNXType + func (s *Sequence) GetShape() Shape + func (s *Sequence) GetValues() ([]Value, error) + func (s *Sequence) ZeroContents() + type Session struct + func NewSessionWithONNXData[T TensorData](onnxData []byte, inputNames, outputNames []string, ...) (*Session[T], error) + func NewSession[T TensorData](onnxFilePath string, inputNames, outputNames []string, ...) (*Session[T], error) + func (s *Session[T]) Run() error + func (s *Session[_]) Destroy() error + type SessionOptions struct + func NewSessionOptions() (*SessionOptions, error) + func (o *SessionOptions) AddSessionConfigEntry(key, value string) error + func (o *SessionOptions) AppendExecutionProviderCUDA(cudaOptions *CUDAProviderOptions) error + func (o *SessionOptions) AppendExecutionProviderCoreML(flags uint32) error + func (o *SessionOptions) AppendExecutionProviderCoreMLV2(options map[string]string) error + func (o *SessionOptions) AppendExecutionProviderDirectML(deviceID int) error + func (o *SessionOptions) AppendExecutionProviderOpenVINO(options map[string]string) error + func (o *SessionOptions) AppendExecutionProviderTensorRT(tensorRTOptions *TensorRTProviderOptions) error + func (o *SessionOptions) Destroy() error + func (o *SessionOptions) GetSessionConfigEntry(key string) (string, error) + func (o *SessionOptions) HasSessionConfigEntry(key string) (bool, error) + func (o *SessionOptions) SetCpuMemArena(isEnabled bool) error + func (o *SessionOptions) SetExecutionMode(newMode ExecutionMode) error + func (o *SessionOptions) SetGraphOptimizationLevel(level GraphOptimizationLevel) error + func (o *SessionOptions) SetInterOpNumThreads(n int) error + func (o *SessionOptions) SetIntraOpNumThreads(n int) error + func (o *SessionOptions) SetMemPattern(isEnabled bool) error + type Shape []int64 + func NewShape(dimensions ...int64) Shape + func (s Shape) Clone() Shape + func (s Shape) Equals(other Shape) bool + func (s Shape) FlattenedSize() int64 + func (s Shape) String() string + func (s Shape) Validate() error + type Tensor struct + func NewEmptyTensor[T TensorData](s Shape) (*Tensor[T], error) + func NewTensor[T TensorData](s Shape, data []T) (*Tensor[T], error) + func (t *Tensor[T]) Clone() (*Tensor[T], error) + func (t *Tensor[T]) DataType() C.ONNXTensorElementDataType + func (t *Tensor[T]) GetData() []T + func (t *Tensor[T]) ZeroContents() + func (t *Tensor[_]) Destroy() error + func (t *Tensor[_]) GetInternals() *ValueInternalData + func (t *Tensor[_]) GetONNXType() ONNXType + func (t *Tensor[_]) GetShape() Shape + type TensorData interface + type TensorElementDataType int + func (t TensorElementDataType) String() string + type TensorInternalData = ValueInternalData + type TensorRTProviderOptions struct + func NewTensorRTProviderOptions() (*TensorRTProviderOptions, error) + func (o *TensorRTProviderOptions) Destroy() error + func (o *TensorRTProviderOptions) Update(options map[string]string) error + type TrainingInputOutputNames struct + EvalInputNames []string + EvalOutputNames []string + TrainingInputNames []string + TrainingOutputNames []string + func GetInputOutputNames(checkpointStatePath string, trainingModelPath string, evalModelPath string) (*TrainingInputOutputNames, error) + type TrainingSession struct + func NewTrainingSession(...) (*TrainingSession, error) + func NewTrainingSessionWithOnnxData(checkpointData, trainingData, evalData, optimizerData []byte, ...) (*TrainingSession, error) + func (s *TrainingSession) Destroy() error + func (s *TrainingSession) ExportModel(path string, outputNames []string) error + func (s *TrainingSession) LazyResetGrad() error + func (s *TrainingSession) OptimizerStep() error + func (s *TrainingSession) SaveCheckpoint(path string, saveOptimizerState bool) error + func (s *TrainingSession) TrainStep() error + type Value interface + DataType func() C.ONNXTensorElementDataType + Destroy func() error + GetInternals func() *ValueInternalData + GetONNXType func() ONNXType + GetShape func() Shape + ZeroContents func() + type ValueInternalData struct