mindspore.nn.get_metric_fn

mindspore.nn.get_metric_fn(name, *args, **kwargs)[source]

Gets the metric method based on the input name.

Parameters
  • name (str) – The name of metric method. Refer to the ‘__factory__’ object for the currently supported metrics.

  • args – Arguments for the metric function.

  • kwargs – Keyword arguments for the metric function.

Returns

Metric object, class instance of the metric method.

Examples

>>> metric = nn.get_metric_fn('precision', eval_type='classification')