xnn.common.benchmark.metrics.register_metric#
- xnn.common.benchmark.metrics.register_metric(name)[source]#
Return a decorator registering an error metric under
name.- Parameters:
name (str) – Name under which to register the metric. Lookups are case-insensitive (the name is lowercased internally).
- Returns:
A decorator that registers the callable it wraps and returns it unchanged.
- Return type:
Callable[[Metric], Metric]
- Raises:
KeyError – When applied, if
nameis already registered to a different callable.
Examples
>>> @register_metric("maxae") ... def max_abs_error(pred, target): ... return float((pred - target).abs().max())