onnxruntime helpers

Frequent functions

onnxruntime.get_device() str

Return the device used to compute the prediction (CPU, MKL, …)

<<<

import onnxruntime
print(onnxruntime.get_device())

>>>

    CPU
onnxruntime.get_all_providers() List[str]

Return list of Execution Providers that this version of Onnxruntime can support. The order of elements represents the default priority order of Execution Providers from highest to lowest.

<<<

import pprint
import onnxruntime
pprint.pprint(onnxruntime.get_all_providers())

>>>

    ['TensorrtExecutionProvider',
     'CUDAExecutionProvider',
     'MIGraphXExecutionProvider',
     'ROCMExecutionProvider',
     'OpenVINOExecutionProvider',
     'DnnlExecutionProvider',
     'NupharExecutionProvider',
     'TvmExecutionProvider',
     'VitisAIExecutionProvider',
     'NnapiExecutionProvider',
     'CoreMLExecutionProvider',
     'ArmNNExecutionProvider',
     'ACLExecutionProvider',
     'DmlExecutionProvider',
     'RknpuExecutionProvider',
     'CPUExecutionProvider']
onnxruntime.get_available_providers() List[str]

Return list of available Execution Providers in this installed version of Onnxruntime. The order of elements represents the default priority order of Execution Providers from highest to lowest.

<<<

import onnxruntime
import pprint
pprint.pprint(onnxruntime.get_available_providers())

>>>

    ['CPUExecutionProvider']
onnxruntime.set_default_logger_severity(arg0: int) None

Sets the default logging severity. 0:Verbose, 1:Info, 2:Warning, 3:Error, 4:Fatal

onnxruntime.set_seed(arg0: int) None

Sets the seed used for random number generation in Onnxruntime.

Python Wrapper OrtDevice

class onnxruntime.OrtDevice(c_ort_device)[source]

A data structure that exposes the underlying C++ OrtDevice

device_id()[source]
device_type()[source]
static make(ort_device_name, device_id)[source]

C class, OrtDevice or C_OrtDevice

class onnxruntime.capi._pybind_state.OrtDevice

ONNXRuntime device informaion.

static cpu() int
static cuda() int
static default_memory() int
device_id(self: onnxruntime.capi.onnxruntime_pybind11_state.OrtDevice) int

Device Id.

device_type(self: onnxruntime.capi.onnxruntime_pybind11_state.OrtDevice) int

Device Type.

OrtMemoryInfo

class onnxruntime.capi._pybind_state.OrtMemoryInfo

C classes, frequent types

class onnxruntime.capi._pybind_state.ModelMetadata

Pre-defined and custom metadata about the model. It is usually used to identify the model used to run the prediction and facilitate the comparison.

property custom_metadata_map

additional metadata

property description

description of the model

property domain

ONNX domain

property graph_description

description of the graph hosted in the model

property graph_name

graph name

property producer_name

producer name

property version

version of the model

class onnxruntime.capi._pybind_state.OrtMemType

Members:

CPU_INPUT

CPU_OUTPUT

CPU

DEFAULT

property name

Rare functions

onnxruntime.capi._pybind_state.clear_training_ep_instances() None

Clean the execution provider instances used in ort training module.

onnxruntime.capi._pybind_state.create_and_register_allocator(arg0: OrtMemoryInfo, arg1: OrtArenaCfg) None
onnxruntime.capi._pybind_state.enable_telemetry_events() None

Enables platform-specific telemetry collection where applicable.

onnxruntime.capi._pybind_state.disable_telemetry_events() None

Disables platform-specific telemetry collection.