|
def | basic_compare_func (check_shapes=None, rtol=None, atol=None, fail_fast=None, find_output_func=None) |
|
Provides functions that can be used to compare two `IterationResult` s.
◆ basic_compare_func()
def polygraphy.comparator.compare.CompareFunc.basic_compare_func |
( |
|
check_shapes = None , |
|
|
|
rtol = None , |
|
|
|
atol = None , |
|
|
|
fail_fast = None , |
|
|
|
find_output_func = None |
|
) |
| |
|
static |
Creates a function that compares two IterationResults, and can be used as the `compare_func` argument
in ``Comparator.compare_accuracy``.
This function uses ``np.isclose`` to determine whether outputs match.
For details, see https://docs.scipy.org/doc/numpy/reference/generated/numpy.isclose.html.
Args:
check_shapes (bool):
Whether shapes must match exactly. If this is False, this function may
permute or reshape outputs before comparison. Defaults to True.
rtol (Union[float, Dict[str, float]]):
The relative tolerance to use when checking accuracy. Defaults to 1e-5.
This can be provided on a per-output basis using a dictionary. In that case,
use an empty string ("") as the key to specify default tolerance for outputs not explicitly listed.
atol (Union[float, Dict[str, float]]):
The absolute tolerance to use when checking accuracy. Defaults to 1e-5.
This can be provided on a per-output basis using a dictionary. In that case,
use an empty string ("") as the key to specify default tolerance for outputs not explicitly listed.
fail_fast (bool):
Whether the function should exit immediately after the first failure. Defaults to False.
find_output_func (Callable(str, int, IterationResult) -> List[str]):
A callback that returns a list of output names to compare against from the provided
IterationResult, given an output name and index from another IterationResult.
The comparison function will always iterate over the output names of the
first IterationResult, expecting names from the second. A return value of
`[]` or `None` indicates that the output should be skipped.
Returns:
Callable(IterationResult, IterationResult) -> OrderedDict[str, OutputCompareResult]:
A callable that returns a mapping of output names to `OutputCompareResult` s, indicating
whether the corresponding output matched.
The documentation for this class was generated from the following file: