コード例 #1
0
ファイル: metric_manager.py プロジェクト: hexfaker/matches
    def consume(
        self,
        name: str,
        metric: Metric,
        iteration: Union[str, IterationType, int] = IterationType.AUTO,
    ):
        r"""Shortcut for logging and resetting metric in one call

        Shortcut for common scenario. Computes metric value, logs it and then resets it to prepare
        for new updates.

        If you don't need reset call ordinary :meth:`log`::

            metrics.log(name, metric.compute(),...)

        Args:
            name: Metric name
            metric: Metric object to log and reset
            iteration: Iteration on which metric is recorded. See Note
        Returns:
              None
        """
        self.log(name, metric.compute(), iteration=iteration)
        metric.reset()
コード例 #2
0
def test_abstract_class():
    with raises(TypeError):
        Metric()
コード例 #3
0
 def __init__(self, output_transform=lambda x: x):
     Metric.__init__(self, output_transform=output_transform)
     self.reset()
コード例 #4
0
ファイル: metrics.py プロジェクト: kahartma/eeggan
 def __init__(self):
     self.values: List[Tuple[int, T]]
     Metric.__init__(self)
コード例 #5
0
 def __init__(self, output_transform=lambda x: x, log_interval=100):
     self.model_state = Message()
     Metric.__init__(self, output_transform=output_transform)
     self.log_interval = log_interval