from tensorflow.python.ops import array_ops

      `false_positives` variables appropriately, and whose value matches
      `precision`.

  Raises:
    ValueError: If `ignore_mask` is not `None` and its shape doesn't match
      `predictions`, or if `weights` is not `None` and its shape doesn't match
      `predictions`, or if either `metrics_collections` or `updates_collections`
      are not a list or tuple.
    ValueError: If `top_k_predictions` has rank < 2.
  """
  default_name = _at_k_name('precision', class_id=class_id)
  with ops.name_scope(
      name, default_name,
      (top_k_predictions, labels, ignore_mask, weights)) as scope:
    rank = array_ops.rank(top_k_predictions)
    check_rank_op = control_flow_ops.Assert(
        math_ops.greater_equal(rank, 2),
        ['top_k_predictions must have rank 2 or higher, e.g. [batch_size, k].'])
    with ops.control_dependencies([check_rank_op]):
      return _streaming_sparse_precision_at_k(
          top_k_idx=top_k_predictions,
          labels=labels,
          class_id=class_id,
          ignore_mask=ignore_mask,
          weights=weights,
          metrics_collections=metrics_collections,
          updates_collections=updates_collections,
          name=scope)
