code: def alpha_discounted_cumulative_gain(
      labels,
      predictions,
      weights=None,
      topn=None,
      name=None,
      rank_discount_fn=_DEFAULT_RANK_DISCOUNT_FN,
      alpha=0.5,
      seed=None,
  ):
      """Computes alpha discounted cumulative gain (alpha-DCG).
  
      Args:
        labels: A `Tensor` with shape [batch_size, list_size, subtopic_size]. Each
          value represents graded relevance to a subtopic: 1 for relevent subtopic,
          0 for irrelevant, and -1 for paddings. When the actual subtopic number
          of a query is smaller than the `subtopic_size`, `labels` will be padded
          to `subtopic_size` with -1, similar to the paddings used for queries
          with doc number less then list_size.
        predictions: A `Tensor` with shape [batch_size, list_size]. Each value is
          the ranking score of the corresponding example.
        weights: A `Tensor` of shape [batch_size, list_size] or [batch_size, 1].
          They are per-example and per-list, respectively.
        topn: A cutoff for how many examples to consider for this metric.
        name: A string used as the name for this metric.
        rank_discount_fn: A function of rank discounts. Default is set to
          discount = 1 / log2(rank+1).
        alpha: A float between 0 and 1. Originally introduced as an assessor error
          in judging whether a document is covering a subtopic of the query. It
          can also be interpreted as the inverse number of documents covering the
          same subtopic reader needs to get and confirm the subtopic information
          of a query.
        seed: The ops-level random seed used in shuffle ties in `sort_by_scores`.
  
      Returns:
        A metric for the weighted alpha discounted cumulative gain of the batch.
      """
      metric = metrics_impl.AlphaDCGMetric(
          name,
          topn,
          alpha=alpha,
          rank_discount_fn=rank_discount_fn,
          seed=seed,
      )
      with tf.compat.v1.name_scope(
          name,
          "alpha_discounted_cumulative_gain",
          (labels, predictions, weights),
      ):
          # TODO: Add mask argument for metric.compute() call
          alpha_dcg, per_list_weights = metric.compute(
              labels, predictions, weights
          )
      return tf.compat.v1.metrics.mean(alpha_dcg, per_list_weights)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import inspect
  import tensorflow
  from tensorflow_ranking.python import metrics_impl
  from tensorflow_ranking.python import utils
label_desc: Use image node_id 11 for calling a global function with example usage: alpha_discounted_cumulative_gain(labels, predictions, weights, topn, name, rank_discount_fn, alpha, seed) and returns: tf