dgs.models.metric.get_metric

dgs.models.metric.get_metric(instance: str | type) Type[torch.nn.Module][source]

Given the name or an instance of a metric, return the respective instance.

Parameters:

instance – Either the name of the metric, which has to be in :data:METRICS, or a subclass of Metric.

Raises:

ValueError – If the instance has the wrong type.

Returns:

The class of the given metric.