ONNXBackendRep

class dragon.vm.tensorrt.ONNXBackendRep(
  model,
  device,
  max_batch_size=32,
  max_workspace_size=None,
  optimization_profiles=None,
  serialize_engine=False
)[source]

Load and run onnx models.

__init__

ONNXBackendRep.__init__(
  model,
  device,
  max_batch_size=32,
  max_workspace_size=None,
  optimization_profiles=None,
  serialize_engine=False
)[source]

Create a ONNXBackendRep.

Parameters:
  • model (onnx.ModelProto) – The onnx model.
  • device (onnx.Device) – The executing device.
  • max_batch_size (int, optional, default=32) – The max batch size.
  • max_workspace_size (int, optional) – The max workspace size in bytes.
  • optimization_profiles (List[Dict], optional) – The optimization profiles.
  • serialize_engine (bool, optional, default=False) – Whether to serialize engine into a file.

Properties

engine

ONNXBackendRep.engine

Return the executing engine.

Returns:
dragon.vm.tensorrt.Engine – The executing engine

Methods

run

ONNXBackendRep.run(
  inputs,
  optimization_profile=None,
  **kwargs
)[source]

Run the model.

Parameters:
  • inputs (Union[Sequence, Dict]) – The input arrays.
  • optimization_profile (int, optional) – The index of optimization profile to use.
Returns:

namedtuple – The model outputs.