code: def log_combinations(n, counts, name="log_combinations"):
      """Log multinomial coefficient.
  
      Given `n` and `counts`, where `counts` has last dimension `k`, we define
      the multinomial coefficient as:
  
      ```n! / prod_i n_i!```
  
      where `i` runs over all `k` classes.
  
      This function computes the natural logarithm of the multinomial coefficient.
  
      Args:
        n: Floating-point `Tensor` broadcastable with `counts`. This represents `n`
          outcomes.
        counts: Floating-point `Tensor` broadcastable with `n`. This represents
          counts in `k` classes, where `k` is the last dimension of the tensor.
        name: A name for this operation (optional).
  
      Returns:
        log_combinations: `Tensor` representing the log of the multinomial
          coefficient between `n` and `counts`.
      """
      # First a bit about the number of ways counts could have come in:
      # E.g. if counts = [1, 2], then this is 3 choose 2.
      # In general, this is (sum counts)! / sum(counts!)
      # The sum should be along the last dimension of counts. This is the
      # 'distribution' dimension. Here n a priori represents the sum of counts.
      with tf.name_scope(name):
          n = tf.convert_to_tensor(n, name="n")
          counts = tf.convert_to_tensor(counts, name="counts")
          total_permutations = tf.math.lgamma(n + 1)
          counts_factorial = tf.math.lgamma(counts + 1)
          redundant_permutations = tf.reduce_sum(
              counts_factorial, axis=-1
          )
          return total_permutations - redundant_permutations
  
imports: import collections
  import functools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import custom_gradient
  from tensorflow_probability.python.internal import distribute_lib
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import variadic_reduce
  from tensorflow_probability.python.math.scan_associative import scan_associative
  from tensorflow.python.util import deprecation
label_desc: Use image node_id 1 for calling a global function with example usage: log_combinations(n, counts, name) and returns: unknown