Comparison Functions

Module: polygraphy.tools.args

class CompareFuncSimpleArgs[source]

Bases: BaseArgs

Comparison Function: simple: the SimpleCompareFunc comparison function.

Depends on:

  • ComparatorCompareArgs

parse_impl(args)[source]

Parses command-line arguments and populates the following attributes:

rtol

Per-tensor relative tolerance.

Type:

Dict[str, float]

atol

Per-tensor absolute tolerance.

Type:

Dict[str, float]

check_error_stat

The error metric to check.

Type:

str

infinities_compare_equal

Whether to allow +-inf to compare as equal.

Type:

bool

save_heatmaps

Directory in which to save heatmaps of error.

Type:

str

show_heatmaps

Whether to display heatmaps of error.

Type:

bool

save_error_metrics_plot

Path to store generated error plots.

Type:

str

show_error_metrics_plot

Whether to display the error metrics plots.

Type:

bool

error_quantile

Per-tensor quantile of error to compute.

Type:

Dict[str, float]

class CompareFuncIndicesArgs[source]

Bases: BaseArgs

Comparison Function: indices: the IndicesCompareFunc comparison function.

Depends on:

  • ComparatorCompareArgs

parse_impl(args)[source]

Parses command-line arguments and populates the following attributes:

index_tolerance

Per-tensor index tolerance.

Type:

Dict[str, int]

class CompareFuncL2Args[source]

Bases: BaseArgs

Comparison Function: l2: the L2CompareFunc comparison function.

Depends on:

  • ComparatorCompareArgs

parse_impl(args)[source]

Parses command-line arguments and populates the following attributes:

l2_threshold

Per-tensor L2 norm threshold.

Type:

Dict[str, float]

class CompareFuncCosineSimilarityArgs[source]

Bases: BaseArgs

Comparison Function: cosine_similarity: the CosineSimilarityCompareFunc comparison function.

Depends on:

  • ComparatorCompareArgs

parse_impl(args)[source]

Parses command-line arguments and populates the following attributes:

cosine_similarity_threshold

Per-tensor cosine similarity thresholds.

Type:

Dict[str, float]

class CompareFuncPsnrArgs[source]

Bases: BaseArgs

Comparison Function: psnr: the PsnrCompareFunc comparison function.

Depends on:

  • ComparatorCompareArgs

parse_impl(args)[source]

Parses command-line arguments and populates the following attributes:

psnr_threshold

Per-tensor PSNR threshold.

Type:

Dict[str, float]

class CompareFuncSnrArgs[source]

Bases: BaseArgs

Comparison Function: snr: the SnrCompareFunc comparison function.

Depends on:

  • ComparatorCompareArgs

parse_impl(args)[source]

Parses command-line arguments and populates the following attributes:

snr_threshold

Per-tensor SNR threshold.

Type:

Dict[str, float]

class CompareFuncPerceptualMetricsArgs[source]

Bases: BaseArgs

Comparison Function: perceptual_metrics: the PerceptualMetricsCompareFunc comparison function.

Depends on:

  • ComparatorCompareArgs

parse_impl(args)[source]

Parses command-line arguments and populates the following attributes:

lpips_threshold

Per-tensor LPIPS thresholds.

Type:

Dict[str, float]