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()
def test_abstract_class(): with raises(TypeError): Metric()
def __init__(self, output_transform=lambda x: x): Metric.__init__(self, output_transform=output_transform) self.reset()
def __init__(self): self.values: List[Tuple[int, T]] Metric.__init__(self)
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