Make it more explicit about the return type of the metric.result().
@@ -121,8 +121,8 @@ class Metric(base_layer.Layer, metaclass=abc.ABCMeta):
calling `self.add_weight()` like: `self.var = self.add_weight(...)`
* `update_state()`: Has all updates to the state variables like:
self.var.assign_add(...).
- * `result()`: Computes and returns a scalar value for the metric
- from the state variables.
+ * `result()`: Computes and returns a scalar value or a dict of scalar values
+ for the metric from the state variables.
Example subclass implementation:
@@ -323,7 +323,7 @@ class Metric(base_layer.Layer, metaclass=abc.ABCMeta):
@abc.abstractmethod
def result(self):
- """Computes and returns the scalar metric value tensor.
+ """Computes and returns the scalar metric value tensor or a dict of scalars.
Result computation is an idempotent operation that simply calculates the
metric value using the state variables.
