parameters: (n, counts, name="log_combinations")
docstring: Multinomial coefficient.
  
    Given `n` and `counts`, where `counts` has last dimension `k`, we compute
    the multinomial coefficient as:
  
    ```n! / sum_i n_i!```
  
    where `i` runs over all `k` classes.
  
    Args:
      n: Numeric `Tensor` broadcastable with `counts`. This represents `n`
        outcomes.
      counts: Numeric `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:
      `Tensor` representing the multinomial coefficient between `n` and `counts`.
docstring_summary: Multinomial coefficient.
docstring_tokens: Multinomial coefficient .
function: def log_combinations(n, counts, name="log_combinations"):
    """Multinomial coefficient.
  
    Given `n` and `counts`, where `counts` has last dimension `k`, we compute
    the multinomial coefficient as:
  
    ```n! / sum_i n_i!```
  
    where `i` runs over all `k` classes.
  
    Args:
      n: Numeric `Tensor` broadcastable with `counts`. This represents `n`
        outcomes.
      counts: Numeric `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:
      `Tensor` representing 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 ops.op_scope([n, counts], name):
      total_permutations = math_ops.lgamma(n + 1)
      counts_factorial = math_ops.lgamma(counts + 1)
      redundant_permutations = math_ops.reduce_sum(counts_factorial,
                                                   reduction_indices=[-1])
      return total_permutations - redundant_permutations
function_tokens: def log_combinations ( n , counts , name = "log_combinations" ) : # 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 ops . op_scope ( [ n , counts ] , name ) : total_permutations = math_ops . lgamma ( n + 1 ) counts_factorial = math_ops . lgamma ( counts + 1 ) redundant_permutations = math_ops . reduce_sum ( counts_factorial , reduction_indices = [ - 1 ] ) return total_permutations - redundant_permutations