afe.apis.statistic

Analysis of statistics on tensors.

Attributes

Metric

Functions

equality(β†’Β float)

Equality as a distance metric.

mean_float(β†’Β float)

Mean value of difference between input values and ground truth values.

threshold_test_counter(...)

Create a Statistic over a stream of (x, y) pairs

tensor_set_statistics(...)

Apply an independent Statistic to each tensor in a stream of pairs of

mean(...)

Create a statistic that takes input pairs (i, g)

mean_text(...)

Create a statistic that takes input pairs (i, g)

Module Contents

afe.apis.statistic.Metric[source]
afe.apis.statistic.equality(x: afe.apis.compilation_job_base.Tensor, y: afe.apis.compilation_job_base.Tensor) float[source]

Equality as a distance metric.

Return 0 if the tensors are equal, 1 otherwise.

afe.apis.statistic.mean_float(x: afe.apis.compilation_job_base.Tensor, y: afe.apis.compilation_job_base.Tensor) float[source]

Mean value of difference between input values and ground truth values.

afe.apis.statistic.threshold_test_counter(metric: Metric, threshold: float) afe.driver.statistic.Statistic[Tuple[afe.apis.compilation_job_base.Tensor, afe.apis.compilation_job_base.Tensor], str][source]

Create a Statistic over a stream of (x, y) pairs that counts the number of times metric(x, y) < threshold is satisfied.

Parameters:
  • metric – Distance metric

  • threshold – Threshold to compare against

Returns:

Statistic that captures the data

afe.apis.statistic.tensor_set_statistics(statistics: List[afe.driver.statistic.Statistic[Tuple[Any, Any], str]]) afe.driver.statistic.Statistic[Tuple[List[Any], List[Any]], str][source]

Apply an independent Statistic to each tensor in a stream of pairs of fixed-length lists.

This is intended for evaluating models that have multiple outputs and a ground truth value corresponding to each output. Each Statistic would be applied to one of the outputs and ground truth values.

Parameters:

statistics – Statistic to apply to each pair of values

Returns:

Composed statistic that applies the statistics to list items

afe.apis.statistic.mean(metric: Metric) afe.driver.statistic.Statistic[Tuple[List[afe.apis.compilation_job_base.Tensor], afe.apis.compilation_job_base.Tensor], float][source]

Create a statistic that takes input pairs (i, g) and computes the arithmetic mean of metric(i, g) over all given inputs.

Parameters:

metric – Mean metric.

Returns:

Statistic that captures the data

afe.apis.statistic.mean_text(metric: Metric) afe.driver.statistic.Statistic[Tuple[List[afe.apis.compilation_job_base.Tensor], afe.apis.compilation_job_base.Tensor], str][source]

Create a statistic that takes input pairs (i, g) and computes the arithmetic mean of metric(i, g) over all given inputs and formats the results as text message.

Parameters:

metric – Mean metric.

Returns:

Statistic that captures the data