TensorRT  7.2.1.6
NVIDIA TensorRT
Looking for a C++ dev who knows TensorRT?
I'm looking for work. Hire me!
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
polygraphy.comparator.struct.AccuracyResult Class Reference
Inheritance diagram for polygraphy.comparator.struct.AccuracyResult:
Collaboration diagram for polygraphy.comparator.struct.AccuracyResult:

Public Member Functions

def __bool__ (self)
 
def percentage (self, runner_pair=None)
 
def stats (self, runner_pair=None)
 

Private Member Functions

def _get_runner_pair (self, runner_pair)
 

Detailed Description

An ordered dictionary including details about the result of `Comparator.compare_accuracy`.

More specifically, it is an OrderedDict[Tuple[str, str], List[OrderedDict[str, bool]]] which maps a runner
pair (a tuple containing both runner names) to a list of dictionaries of booleans (or anything that can be
converted into a boolean, such as an OutputCompareResult), indicating whether there was a match in the outputs of
the corresponding iteration. The List[OrderedDict[str, bool]] is constructed from the dictionaries returned
by `compare_func` in `compare_accuracy`.

For example, to see if there was a match in "output0" between "runner0" and
"runner1" on the 1st iteration, you would do the following:
::

    output_name = "output0"
    runner_pair = ("runner0", "runner1")
    iteration = 0
    match = bool(accuracy_result[runner_pair][iteration][output_name])

In case there's a mismatch, you would be able to inspect the outputs in question by accessing
the results from Comparator.run() (assumed here to be called run_results):
::

    runner0_output = run_results["runner0"][iteration][output_name]
    runner1_output = run_results["runner1"][iteration][output_name]

Member Function Documentation

◆ __bool__()

def polygraphy.comparator.struct.AccuracyResult.__bool__ (   self)
Whether all outputs matched for every iteration.
You can use this function to avoid manually checking each output. For example:
::

    if accuracy_result:
print("All matched!")

Returns:
    bool
Here is the call graph for this function:

◆ _get_runner_pair()

def polygraphy.comparator.struct.AccuracyResult._get_runner_pair (   self,
  runner_pair 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ percentage()

def polygraphy.comparator.struct.AccuracyResult.percentage (   self,
  runner_pair = None 
)
Returns the percentage of iterations that matched for the given pair of runners,
expressed as a decimal between 0.0 and 1.0.

Always returns 1.0 when the number of iterations is 0, or when there are no runner comparisons.

Args:
    runner_pair ((str, str)):
    A pair of runner names describing which runners to check.
    Defaults to the first pair in the dictionary.
Here is the call graph for this function:

◆ stats()

def polygraphy.comparator.struct.AccuracyResult.stats (   self,
  runner_pair = None 
)
Returns the number of iterations that matched, mismatched, and the total number of iterations.

Args:
    runner_pair ((str, str)):
    A pair of runner names describing which runners to check.
    Defaults to the first pair in the dictionary.

Returns:
    (int, int, int): Number of iterations that matched, mismatched, and total respectively.
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: