Public Member Functions | |
def | __init__ (self, name=None, prefix=None) |
def | last_inference_time (self) |
def | __enter__ (self) |
def | __exit__ (self, exc_type, exc_value, traceback) |
def | activate_impl (self) |
def | activate (self) |
def | infer_impl (self) |
def | infer (self, feed_dict) |
def | get_input_metadata (self) |
def | deactivate_impl (self) |
def | deactivate (self) |
def | __del__ (self) |
Public Attributes | |
name | |
inference_time | |
is_active | |
Static Public Attributes | |
RUNNER_COUNTS = defaultdict(int) | |
The base class for runner objects. All runners should override the functions and attributes specified here.
def polygraphy.backend.base.runner.BaseRunner.__init__ | ( | self, | |
name = None , |
|||
prefix = None |
|||
) |
Args: name (str): The name to use for this runner. prefix (str): The human-readable name prefix to use for this runner. A runner count and timestamp will be appended to this prefix. Only used if name is not provided.
Reimplemented in polygraphy.backend.onnxrt.runner.OnnxrtRunner, polygraphy.backend.onnx.runner.OnnxTfRunner, polygraphy.backend.cntk.runner.CNTKRunner, and polygraphy.backend.trt.runner.TrtRunner.
def polygraphy.backend.base.runner.BaseRunner.__del__ | ( | self | ) |
def polygraphy.backend.base.runner.BaseRunner.last_inference_time | ( | self | ) |
Returns the total inference time required during the last call to ``infer()``. Returns: float: The time in seconds, or None if runtime was not measured by the runner.
def polygraphy.backend.base.runner.BaseRunner.__enter__ | ( | self | ) |
def polygraphy.backend.base.runner.BaseRunner.__exit__ | ( | self, | |
exc_type, | |||
exc_value, | |||
traceback | |||
) |
def polygraphy.backend.base.runner.BaseRunner.activate_impl | ( | self | ) |
Implementation for runner activation. Derived classes should override this function rather than ``activate()``.
Reimplemented in polygraphy.backend.trt_legacy.TrtLegacyRunner, polygraphy.backend.tf.runner.TfRunner, polygraphy.backend.trt.runner.TrtRunner, polygraphy.backend.pyt.runner.PytRunner, polygraphy.backend.onnxrt.runner.OnnxrtRunner, polygraphy.backend.onnx.runner.OnnxTfRunner, and polygraphy.backend.cntk.runner.CNTKRunner.
def polygraphy.backend.base.runner.BaseRunner.activate | ( | self | ) |
Activate the runner for inference. This may involve allocating GPU buffers, for example.
def polygraphy.backend.base.runner.BaseRunner.infer_impl | ( | self | ) |
Implementation for runner inference. Derived classes should override this function rather than ``infer()``
def polygraphy.backend.base.runner.BaseRunner.infer | ( | self, | |
feed_dict | |||
) |
Runs inference using the provided feed_dict. Args: feed_dict (OrderedDict[str, numpy.ndarray]): A mapping of input tensor names to corresponding input NumPy arrays. Returns: OrderedDict[str, numpy.ndarray]: A mapping of output tensor names to their corresponding NumPy arrays. IMPORTANT: Runners may reuse these output buffers. Thus, if you need to save outputs from multiple inferences, you should make a copy with ``copy.copy(outputs)``.
def polygraphy.backend.base.runner.BaseRunner.get_input_metadata | ( | self | ) |
Returns information about the inputs of the model. Shapes here may include dynamic dimensions, represented by ``None``. Must be called only after activate() and before deactivate(). Returns: TensorMetadata: Input names, shapes, and data types.
Reimplemented in polygraphy.backend.trt_legacy.TrtLegacyRunner, polygraphy.backend.tf.runner.TfRunner, polygraphy.backend.onnx.runner.OnnxTfRunner, polygraphy.backend.pyt.runner.PytRunner, polygraphy.backend.onnxrt.runner.OnnxrtRunner, and polygraphy.backend.trt.runner.TrtRunner.
def polygraphy.backend.base.runner.BaseRunner.deactivate_impl | ( | self | ) |
Implementation for runner deactivation. Derived classes should override this function rather than ``deactivate()``.
Reimplemented in polygraphy.backend.trt_legacy.TrtLegacyRunner, polygraphy.backend.trt.runner.TrtRunner, polygraphy.backend.tf.runner.TfRunner, polygraphy.backend.onnx.runner.OnnxTfRunner, and polygraphy.backend.onnxrt.runner.OnnxrtRunner.
def polygraphy.backend.base.runner.BaseRunner.deactivate | ( | self | ) |
Deactivate the runner.
|
static |
polygraphy.backend.base.runner.BaseRunner.name |
polygraphy.backend.base.runner.BaseRunner.inference_time |
polygraphy.backend.base.runner.BaseRunner.is_active |