flambe.metric.metric
¶
Module Contents¶
-
class
flambe.metric.metric.
Metric
[source]¶ Bases:
flambe.compile.Component
Base Metric interface.
Objects implementing this interface should take in a sequence of examples and provide as output a processd list of the same size.
-
compute
(self, pred: torch.Tensor, target: torch.Tensor)[source]¶ Computes the metric over the given prediction and target.
Parameters: - pred (torch.Tensor) – The model predictions
- target (torch.Tensor) – The ground truth targets
Returns: The computed metric
Return type: torch.Tensor
-
aggregate
(self, state: dict, *args, **kwargs)[source]¶ Parameters: - state (dict) – the state dictionary
- args – normally pred, target
- kwargs –
Returns: The updated state (even though the update happens in-place)
Return type: dict
-