code: def evaluate(
      ground_truth: type_alias.TensorLike,
      prediction: type_alias.TensorLike,
      precision_function: Callable[
          ..., Any
      ] = precision_module.evaluate,
      recall_function: Callable[..., Any] = recall_module.evaluate,
      name: str = "fscore_evaluate",
  ) -> tf.Tensor:
      """Computes the fscore metric for the given ground truth and predicted labels.
  
      The fscore is calculated as 2 * (precision * recall) / (precision + recall)
      where the precision and recall are evaluated by the given function parameters.
      The precision and recall functions default to their definition for boolean
      labels (see https://en.wikipedia.org/wiki/Precision_and_recall for more
      details).
  
      Note:
        In the following, A1 to An are optional batch dimensions, which must be
        broadcast compatible.
  
      Args:
        ground_truth: A tensor of shape `[A1, ..., An, N]`, where the last axis
          represents the ground truth values.
        prediction: A tensor of shape `[A1, ..., An, N]`, where the last axis
          represents the predicted values.
        precision_function: The function to use for evaluating the precision.
          Defaults to the precision evaluation for binary ground-truth and
          predictions.
        recall_function: The function to use for evaluating the recall. Defaults to
          the recall evaluation for binary ground-truth and prediction.
        name: A name for this op. Defaults to "fscore_evaluate".
  
      Returns:
        A tensor of shape `[A1, ..., An]` that stores the fscore metric for the
        given ground truth labels and predictions.
  
      Raises:
        ValueError: if the shape of `ground_truth`, `prediction` is
        not supported.
      """
      with tf.name_scope(name):
          ground_truth = tf.convert_to_tensor(value=ground_truth)
          prediction = tf.convert_to_tensor(value=prediction)
  
          shape.compare_batch_dimensions(
              tensors=(ground_truth, prediction),
              tensor_names=("ground_truth", "prediction"),
              last_axes=-1,
              broadcast_compatible=True,
          )
  
          recall = recall_function(ground_truth, prediction)
          precision = precision_function(ground_truth, prediction)
  
          return safe_ops.safe_signed_div(
              2 * precision * recall, precision + recall
          )
  
file_path: graphics/tensorflow_graphics/nn/metric/fscore.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Any, Callable
  import tensorflow
  from tensorflow_graphics.nn.metric import precision
  from tensorflow_graphics.nn.metric import recall
  from tensorflow_graphics.util import export_api
  from tensorflow_graphics.util import safe_ops
  from tensorflow_graphics.util import shape
  from tensorflow_graphics.util import type_alias
label_desc: Use image node_id 1 for calling a global function with example usage: evaluate(ground_truth, prediction, precision_function, recall_function, name) and returns: safe_ops