parameters: (predictions_idx,
                                  labels,
                                  class_id=None,
                                  weights=None)
docstring: Calculates false positives for precision@k.
  
    If `class_id` is specified, calculate binary true positives for `class_id`
        only.
    If `class_id` is not specified, calculate metrics for `k` predicted vs
        `n` label classes, where `n` is the 2nd dimension of `labels_sparse`.
  
    Args:
      predictions_idx: 1-D or higher `int64` `Tensor` with last dimension `k`,
        top `k` predicted classes. For rank `n`, the first `n-1` dimensions must
        match `labels`.
      labels: `int64` `Tensor` or `SparseTensor` with shape
        [D1, ... DN, num_labels], where N >= 1 and num_labels is the number of
        target classes for the associated prediction. Commonly, N=1 and `labels`
        has shape [batch_size, num_labels]. [D1, ... DN] must match
        `predictions_idx`.
      class_id: Class for which we want binary metrics.
      weights: `Tensor` whose shape is broadcastable to the the first [D1, ... DN]
        dimensions of `predictions_idx` and `labels`.
  
    Returns:
      A [D1, ... DN] `Tensor` of false positive counts.
docstring_summary: Calculates false positives for precision@k.
docstring_tokens: Calculates false positives for precision@k .
function: def _sparse_false_positive_at_k(predictions_idx,
                                  labels,
                                  class_id=None,
                                  weights=None):
    """Calculates false positives for precision@k.
  
    If `class_id` is specified, calculate binary true positives for `class_id`
        only.
    If `class_id` is not specified, calculate metrics for `k` predicted vs
        `n` label classes, where `n` is the 2nd dimension of `labels_sparse`.
  
    Args:
      predictions_idx: 1-D or higher `int64` `Tensor` with last dimension `k`,
        top `k` predicted classes. For rank `n`, the first `n-1` dimensions must
        match `labels`.
      labels: `int64` `Tensor` or `SparseTensor` with shape
        [D1, ... DN, num_labels], where N >= 1 and num_labels is the number of
        target classes for the associated prediction. Commonly, N=1 and `labels`
        has shape [batch_size, num_labels]. [D1, ... DN] must match
        `predictions_idx`.
      class_id: Class for which we want binary metrics.
      weights: `Tensor` whose shape is broadcastable to the the first [D1, ... DN]
        dimensions of `predictions_idx` and `labels`.
  
    Returns:
      A [D1, ... DN] `Tensor` of false positive counts.
    """
    with ops.name_scope(None, 'false_positives', (predictions_idx, labels)):
      labels, predictions_idx = _maybe_select_class_id(labels,
                                                       predictions_idx,
                                                       class_id)
      fp = set_ops.set_size(set_ops.set_difference(
          predictions_idx, labels, aminusb=True))
      fp = math_ops.to_double(fp)
      if weights is not None:
        weights = math_ops.to_double(weights)
        fp = math_ops.mul(fp, weights)
      return fp
function_tokens: def _sparse_false_positive_at_k ( predictions_idx , labels , class_id = None , weights = None ) : with ops . name_scope ( None , 'false_positives' , ( predictions_idx , labels ) ) : labels , predictions_idx = _maybe_select_class_id ( labels , predictions_idx , class_id ) fp = set_ops . set_size ( set_ops . set_difference ( predictions_idx , labels , aminusb = True ) ) fp = math_ops . to_double ( fp ) if weights is not None : weights = math_ops . to_double ( weights ) fp = math_ops . mul ( fp , weights ) return fp