latte.metrics.keras.wrapper

Module Contents

Classes

KerasMetricWrapper

A wrapper class for converting a Latte metric to Keras metric.

class KerasMetricWrapper(metric, name=None, **kwargs)

Bases: tensorflow.keras.metrics.Metric

A wrapper class for converting a Latte metric to Keras metric.

Parameters:
  • metric (t.Callable[..., LatteMetric]) – Class handle of the Latte metric to be converted.

  • name (t.Optional[str], optional) – Name of the Keras metric object, by default None. If None, the name of the Latte metric is used.

  • **kwargs – Keyword arguments to be passed to the Latte metric.

See also

tensorflow.keras.metrics.Metric

Keras Metric base class

update_state(*args, **kwargs)

Convert inputs to np.ndarray and call the functional update_state method.

result()

Calculate the metric values and convert them to tf.Tensor or a collection of them.

Returns:

Metric values

Return type:

Union[tf.Tensor, Collection[tf.Tensor]]