<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def evaluate_precision_recall(input_, labels, threshold=0.5, per_example_weights=None, name=PROVIDED, phase=Phase.train):
 """Computes the precision and recall of the prediction vs the labels. Args: input_: A rank 2 Tensor or a Pretty Tensor holding the result of the model. labels: The target labels to learn as a float tensor. threshold: The threshold to use to decide if the prediction is true. per_example_weights: A Tensor with a weight per example. name: An optional name. phase: The phase of this model; non training phases compute a total across all examples. Returns: Precision and Recall. """

  _ = name  # Eliminate warning, name used for namescoping by PT.
  selected, sum_retrieved, sum_relevant = _compute_precision_recall(
      input_, labels, threshold, per_example_weights)

  if phase != Phase.train:
    dtype = tf.float32
    # Create the variables in all cases so that the load logic is easier.
    relevant_count = tf.get_variable(
        'relevant_count', [],
        dtype,
        tf.zeros_initializer(),
        collections=[bookkeeper.GraphKeys.TEST_VARIABLES],
        trainable=False)
    retrieved_count = tf.get_variable(
        'retrieved_count', [],
        dtype,
        tf.zeros_initializer(),
        collections=[bookkeeper.GraphKeys.TEST_VARIABLES],
        trainable=False)
    selected_count = tf.get_variable(
        'selected_count', [],
        dtype,
        tf.zeros_initializer(),
        collections=[bookkeeper.GraphKeys.TEST_VARIABLES],
        trainable=False)

    with input_.g.device(selected_count.device):
      selected = tf.assign_add(selected_count, selected)
    with input_.g.device(retrieved_count.device):
      sum_retrieved = tf.assign_add(retrieved_count, sum_retrieved)
    with input_.g.device(relevant_count.device):
      sum_relevant = tf.assign_add(relevant_count, sum_relevant)

  return (tf.where(tf.equal(sum_retrieved, 0),
                   tf.zeros_like(selected),
                   selected/sum_retrieved),
          tf.where(tf.equal(sum_relevant, 0),
                   tf.zeros_like(selected),
                   selected/sum_relevant))