Loaders

Module: polygraphy.backend.onnxrt

class SessionFromOnnx(model_bytes)[source]

Bases: polygraphy.backend.base.loader.BaseLoader

Functor that builds an ONNX-Runtime inference session.

Builds an ONNX-Runtime inference session.

Parameters

model_bytes (Callable() -> Union[bytes, str]) – A serialized ONNX model or a path to a model, or a callable that returns the same.

call_impl()[source]
Returns

The inference session.

Return type

onnxruntime.InferenceSession

__call__(*args, **kwargs)

Invokes the loader by forwarding arguments to call_impl.

Note: call_impl should not be called directly - use this function instead.

session_from_onnx(model_bytes)

Immediately evaluated functional variant of SessionFromOnnx .

Builds an ONNX-Runtime inference session.

Parameters

model_bytes (Callable() -> Union[bytes, str]) – A serialized ONNX model or a path to a model, or a callable that returns the same.

Returns

The inference session.

Return type

onnxruntime.InferenceSession

SessionFromOnnxBytes

alias of polygraphy.mod.exporter.deprecate.<locals>.deprecate_impl.<locals>.Deprecated

SessionFromOnnxBytes

alias of polygraphy.mod.exporter.deprecate.<locals>.deprecate_impl.<locals>.Deprecated