afe.apis.statistic ================== .. py:module:: afe.apis.statistic .. autoapi-nested-parse:: Analysis of statistics on tensors. Attributes ---------- .. autoapisummary:: afe.apis.statistic.Metric Functions --------- .. autoapisummary:: afe.apis.statistic.equality afe.apis.statistic.mean_float afe.apis.statistic.threshold_test_counter afe.apis.statistic.tensor_set_statistics afe.apis.statistic.mean afe.apis.statistic.mean_text Module Contents --------------- .. py:data:: Metric .. py:function:: equality(x: afe.apis.compilation_job_base.Tensor, y: afe.apis.compilation_job_base.Tensor) -> float Equality as a distance metric. Return 0 if the tensors are equal, 1 otherwise. .. py:function:: mean_float(x: afe.apis.compilation_job_base.Tensor, y: afe.apis.compilation_job_base.Tensor) -> float Mean value of difference between input values and ground truth values. .. py:function:: 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] Create a Statistic over a stream of (x, y) pairs that counts the number of times metric(x, y) < threshold is satisfied. :param metric: Distance metric :param threshold: Threshold to compare against :return: Statistic that captures the data .. py:function:: tensor_set_statistics(statistics: List[afe.driver.statistic.Statistic[Tuple[Any, Any], str]]) -> afe.driver.statistic.Statistic[Tuple[List[Any], List[Any]], str] 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. :param statistics: Statistic to apply to each pair of values :return: Composed statistic that applies the statistics to list items .. py:function:: mean(metric: Metric) -> afe.driver.statistic.Statistic[Tuple[List[afe.apis.compilation_job_base.Tensor], afe.apis.compilation_job_base.Tensor], float] Create a statistic that takes input pairs (i, g) and computes the arithmetic mean of metric(i, g) over all given inputs. :param metric: Mean metric. :return: Statistic that captures the data .. py:function:: mean_text(metric: Metric) -> afe.driver.statistic.Statistic[Tuple[List[afe.apis.compilation_job_base.Tensor], afe.apis.compilation_job_base.Tensor], str] 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. :param metric: Mean metric. :return: Statistic that captures the data