Loaders

Module: polygraphy.tools.args

class OnnxrtSessionArgs[source]

Bases: BaseArgs

ONNX-Runtime Session Creation: creating an ONNX-Runtime Inference Session

Depends on:

  • OnnxLoadArgs

  • ModelArgs

parse_impl(args)[source]

Parses command-line arguments and populates the following attributes:

providers

A list of execution providers.

Type:

List[str]

graph_optimization_level

The graph optimization level enum name (e.g. ORT_ENABLE_EXTENDED), or None to use the ORT default (ORT_ENABLE_ALL).

Type:

str

load_onnxrt_session(model=None)[source]

Loads an ONNX-Runtime Inference Session according to arguments provided on the command-line.

Parameters:

model (Union[bytes, str]) – The model bytes or path to a model. Defaults to None, in which case, the model specified on the command-line is used.

Returns:

onnxruntime.InferenceSession