import tensorflow as tf

        true_positives_lower_bound(labels, logits, weights, surrogate_type),
        'false_positives_upper_bound':
        false_positives_upper_bound(labels, logits, weights, surrogate_type)
    }

    return loss, other_outputs


def precision_at_recall_loss(labels,
                             logits,
                             target_recall,
                             weights=1.0,
                             dual_rate_factor=0.1,
                             label_priors=None,
                             surrogate_type='xent',
                             lambdas_initializer=tf.constant_initializer(1.0),
                             reuse=None,
                             variables_collections=None,
                             trainable=True,
                             scope=None):
  """Computes precision at recall loss.
  The loss is based on a surrogate of the form
     wt * loss(-) + lambdas * (pi * (b - 1) + wt * loss(+))
  where:
  - loss(-) is the cross-entropy loss on the negative examples
  - loss(+) is the cross-entropy loss on the positive examples
  - wt is a scalar or tensor of per-example weights
  - b is the target recall
  - pi is the label_priors.
  The per-example weights change not only the coefficients of individual
