code: def evaluate_classifier_fraction_sparse(input_,
                                          labels,
                                          per_example_weights=None,
                                          topk=1,
                                          name=PROVIDED,
                                          phase=Phase.train):
    
    _ = name  # Suppress lint
    if not (tf.int32.is_compatible_with(labels.dtype) or
            tf.int64.is_compatible_with(labels.dtype)):
      raise ValueError('Labels must be an integer type.: %s.' % labels.dtype)
    correct_predictions, examples = _compute_sparse_average_correct(
        input_, labels, per_example_weights, topk=topk)
    correct_predictions, examples, my_parameters = _eval_metric(
        input_, topk, correct_predictions, examples, phase)
    return input_.with_sequence([correct_predictions, examples], my_parameters)
docs: Calculates the total of correct predictions and example count.
  
    In test and infer mode, this creates variables in the graph collection
    pt.GraphKeys.TEST_VARIABLES and does not add them to
    tf.GraphKeys.ALL_VARIABLES.  This means that you must initialize them
    separately from tf.global_variables_initializer().
  
    This breaks ties left-to-right.
  
    Args:
      input_: A rank 2 Tensor or Pretty Tensor holding the result of the
        model.
      labels: A float or double `Tensor` containing the target for this layer *or*
        an integer `Tensor` with the sparse one-hot indices.
      per_example_weights: Weights that are applied to every example.
      topk: Integer k for 'accuracy at top k' metric.
      name: The name of this layer.
      phase: In training mode the batch accuracy is returned and in eval/infer
        modes a total average is calculated.
    Returns:
      A Pretty Tensor that contains correct_predictions, num_examples.
    Raises:
      ValueError: If labels is not the correct shape.