◆ __init__()
def polygraphy.backend.pyt.runner.PytRunner.__init__ |
( |
|
self, |
|
|
|
model, |
|
|
|
input_metadata, |
|
|
|
output_names, |
|
|
|
name = None |
|
) |
| |
Args:
model (Callable() -> torch.nn.Module):
A model loader that returns a torch.nn.Module or subclass.
input_metadata (TensorMetadata): Mapping of input names to their data types and shapes.
output_names (List[str]):
A list of output names of the model. This information is used by the
Comparator to determine which outputs to compare.
name (str):
The human-readable name prefix to use for this runner.
A runner count and timestamp will be appended to this prefix.
◆ activate_impl()
def polygraphy.backend.pyt.runner.PytRunner.activate_impl |
( |
|
self | ) |
|
◆ infer_impl() [1/2]
def polygraphy.backend.pyt.runner.PytRunner.infer_impl |
( |
|
self, |
|
|
|
feed_dict |
|
) |
| |
◆ get_input_metadata()
def polygraphy.backend.pyt.runner.PytRunner.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 from polygraphy.backend.base.runner.BaseRunner.
◆ last_inference_time()
def polygraphy.backend.base.runner.BaseRunner.last_inference_time |
( |
|
self | ) |
|
|
inherited |
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.
◆ __enter__()
def polygraphy.backend.base.runner.BaseRunner.__enter__ |
( |
|
self | ) |
|
|
inherited |
◆ __exit__()
def polygraphy.backend.base.runner.BaseRunner.__exit__ |
( |
|
self, |
|
|
|
exc_type, |
|
|
|
exc_value, |
|
|
|
traceback |
|
) |
| |
|
inherited |
◆ activate()
def polygraphy.backend.base.runner.BaseRunner.activate |
( |
|
self | ) |
|
|
inherited |
Activate the runner for inference. This may involve allocating GPU buffers, for example.
◆ infer_impl() [2/2]
def polygraphy.backend.base.runner.BaseRunner.infer_impl |
( |
|
self | ) |
|
|
inherited |
Implementation for runner inference. Derived classes should override this function
rather than ``infer()``
◆ infer()
def polygraphy.backend.base.runner.BaseRunner.infer |
( |
|
self, |
|
|
|
feed_dict |
|
) |
| |
|
inherited |
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)``.
◆ deactivate_impl()
def polygraphy.backend.base.runner.BaseRunner.deactivate_impl |
( |
|
self | ) |
|
|
inherited |
◆ deactivate()
def polygraphy.backend.base.runner.BaseRunner.deactivate |
( |
|
self | ) |
|
|
inherited |
◆ _model
polygraphy.backend.pyt.runner.PytRunner._model |
|
private |
◆ input_metadata
polygraphy.backend.pyt.runner.PytRunner.input_metadata |
◆ output_names
polygraphy.backend.pyt.runner.PytRunner.output_names |
◆ RUNNER_COUNTS
polygraphy.backend.base.runner.BaseRunner.RUNNER_COUNTS = defaultdict(int) |
|
staticinherited |
◆ name
polygraphy.backend.base.runner.BaseRunner.name |
|
inherited |
◆ inference_time
polygraphy.backend.base.runner.BaseRunner.inference_time |
|
inherited |
◆ is_active
polygraphy.backend.base.runner.BaseRunner.is_active |
|
inherited |
The documentation for this class was generated from the following file: