class_docstr: Binomial distribution.
  
  This distribution is parameterized by `probs`, a (batch of) probabilities for
  drawing a `1`, and `total_count`, the number of trials per draw from the
  Binomial.
  
  #### Mathematical Details
  
  The Binomial is a distribution over the number of `1`'s in `total_count`
  independent trials, with each trial having the same probability of `1`, i.e.,
  `probs`.
  
  The probability mass function (pmf) is,
  
  ```none
  pmf(k; n, p) = p**k (1 - p)**(n - k) / Z
  Z = k! (n - k)! / n!
  ```
  
  where:
  * `total_count = n`,
  * `probs = p`,
  * `Z` is the normalizing constant, and,
  * `n!` is the factorial of `n`.
  
  #### Examples
  
  Create a single distribution, corresponding to 5 coin flips.
  
  ```python
  dist = Binomial(total_count=5., probs=.5)
  ```
  
  Create a single distribution (using logits), corresponding to 5 coin flips.
  
  ```python
  dist = Binomial(total_count=5., logits=0.)
  ```
  
  Creates 3 distributions with the third distribution most likely to have
  successes.
  
  ```python
  p = [.2, .3, .8]
  # n will be broadcast to [4., 4., 4.], to match p.
  dist = Binomial(total_count=4., probs=p)
  ```
  
  The distribution functions can be evaluated on counts.
  
  ```python
  # counts same shape as p.
  counts = [1., 2, 3]
  dist.prob(counts)  # Shape [3]
  
  # p will be broadcast to [[.2, .3, .8], [.2, .3, .8]] to match counts.
  counts = [[1., 2, 1], [2, 2, 4]]
  dist.prob(counts)  # Shape [2, 3]
  
  # p will be broadcast to shape [5, 7, 3] to match counts.
  counts = [[...]]  # Shape [5, 7, 3]
  dist.prob(counts)  # Shape [5, 7, 3]
  ```
class_docstr_tok: ["Binomial","distribution",".","This","distribution","is","parameterized","by","`","probs","`",",","a","(","batch","of",")","probabilities","for","drawing","a","`","1","`",",","and","`","total_count","`",",","the","number","of","trials","per","draw","from","the","Binomial",".","#","#","#","#","Mathematical","Details","The","Binomial","is","a","distribution","over","the","number","of","`","1","`","'s","in","`","total_count","`","independent","trials",",","with","each","trial","having","the","same","probability","of","`","1","`",",","i.e.",",","`","probs","`",".","The","probability","mass","function","(","pmf",")","is",",","``","`","none","pmf","(","k",";","n",",","p",")","=","p","*","*","k","(","1","-","p",")","*","*","(","n","-","k",")","\/","Z","Z","=","k","!","(","n","-","k",")","!","\/","n","!","``","`","where",":","*","`","total_count","=","n","`",",","*","`","probs","=","p","`",",","*","`","Z","`","is","the","normalizing","constant",",","and",",","*","`","n","!","`","is","the","factorial","of","`","n","`",".","#","#","#","#","Examples","Create","a","single","distribution",",","corresponding","to","5","coin","flips",".","``","`","python","dist","=","Binomial","(","total_count=5.",",","probs=.5",")","``","`","Create","a","single","distribution","(","using","logits",")",",","corresponding","to","5","coin","flips",".","``","`","python","dist","=","Binomial","(","total_count=5.",",","logits=0",".",")","``","`","Creates","3","distributions","with","the","third","distribution","most","likely","to","have","successes",".","``","`","python","p","=","[",".2",",",".3",",",".8","]","#","n","will","be","broadcast","to","[","4.",",","4.",",","4",".","]",",","to","match","p.","dist","=","Binomial","(","total_count=4.",",","probs=p",")","``","`","The","distribution","functions","can","be","evaluated","on","counts",".","``","`","python","#","counts","same","shape","as","p.","counts","=","[","1.",",","2",",","3","]","dist.prob","(","counts",")","#","Shape","[","3","]","#","p","will","be","broadcast","to","[","[",".2",",",".3",",",".8","]",",","[",".2",",",".3",",",".8","]","]","to","match","counts",".","counts","=","[","[","1.",",","2",",","1","]",",","[","2",",","2",",","4","]","]","dist.prob","(","counts",")","#","Shape","[","2",",","3","]","#","p","will","be","broadcast","to","shape","[","5",",","7",",","3","]","to","match","counts",".","counts","=","[","[","...","]","]","#","Shape","[","5",",","7",",","3","]","dist.prob","(","counts",")","#","Shape","[","5",",","7",",","3","]","``","`"]
docstr: Initialize a batch of Binomial distributions.
  
  Args:
    total_count: Non-negative floating point tensor with shape broadcastable
      to `[N1,..., Nm]` with `m >= 0` and the same dtype as `probs` or
      `logits`. Defines this as a batch of `N1 x ...  x Nm` different Binomial
      distributions. Its components should be equal to integer values.
    logits: Floating point tensor representing the log-odds of a
      positive event with shape broadcastable to `[N1,..., Nm]` `m >= 0`, and
      the same dtype as `total_count`. Each entry represents logits for the
      probability of success for independent Binomial distributions. Only one
      of `logits` or `probs` should be passed in.
    probs: Positive floating point tensor with shape broadcastable to
      `[N1,..., Nm]` `m >= 0`, `probs in [0, 1]`. Each entry represents the
      probability of success for independent Binomial distributions. Only one
      of `logits` or `probs` should be passed in.
    validate_args: Python `bool`, default `False`. When `True` distribution
      parameters are checked for validity despite possibly degrading runtime
      performance. When `False` invalid inputs may silently render incorrect
      outputs.
    allow_nan_stats: Python `bool`, default `True`. When `True`, statistics
      (e.g., mean, mode, variance) use the value "`NaN`" to indicate the
      result is undefined. When `False`, an exception is raised if one or
      more of the statistic's batch members are undefined.
    name: Python `str` name prefixed to Ops created by this class.
docstr_tok: ["Initialize","a","batch","of","Binomial","distributions",".","Args",":","total_count",":","Non-negative","floating","point","tensor","with","shape","broadcastable","to","`","[","N1",",","...",",","Nm","]","`","with","`","m",">","=","0","`","and","the","same","dtype","as","`","probs","`","or","`","logits","`",".","Defines","this","as","a","batch","of","`","N1","x","...","x","Nm","`","different","Binomial","distributions",".","Its","components","should","be","equal","to","integer","values",".","logits",":","Floating","point","tensor","representing","the","log-odds","of","a","positive","event","with","shape","broadcastable","to","`","[","N1",",","...",",","Nm","]","`","`","m",">","=","0","`",",","and","the","same","dtype","as","`","total_count","`",".","Each","entry","represents","logits","for","the","probability","of","success","for","independent","Binomial","distributions",".","Only","one","of","`","logits","`","or","`","probs","`","should","be","passed","in",".","probs",":","Positive","floating","point","tensor","with","shape","broadcastable","to","`","[","N1",",","...",",","Nm","]","`","`","m",">","=","0","`",",","`","probs","in","[","0",",","1","]","`",".","Each","entry","represents","the","probability","of","success","for","independent","Binomial","distributions",".","Only","one","of","`","logits","`","or","`","probs","`","should","be","passed","in",".","validate_args",":","Python","`","bool","`",",","default","`","False","`",".","When","`","True","`","distribution","parameters","are","checked","for","validity","despite","possibly","degrading","runtime","performance",".","When","`","False","`","invalid","inputs","may","silently","render","incorrect","outputs",".","allow_nan_stats",":","Python","`","bool","`",",","default","`","True","`",".","When","`","True","`",",","statistics","(","e.g.",",","mean",",","mode",",","variance",")","use","the","value","``","`","NaN","`","``","to","indicate","the","result","is","undefined",".","When","`","False","`",",","an","exception","is","raised","if","one","or","more","of","the","statistic","'s","batch","members","are","undefined",".","name",":","Python","`","str","`","name","prefixed","to","Ops","created","by","this","class","."]
code: def __init__(
      self,
      total_count,
      logits=None,
      probs=None,
      validate_args=False,
      allow_nan_stats=True,
      name=None,
  ):
      """Initialize a batch of Binomial distributions.
  
      Args:
        total_count: Non-negative floating point tensor with shape broadcastable
          to `[N1,..., Nm]` with `m >= 0` and the same dtype as `probs` or
          `logits`. Defines this as a batch of `N1 x ...  x Nm` different Binomial
          distributions. Its components should be equal to integer values.
        logits: Floating point tensor representing the log-odds of a
          positive event with shape broadcastable to `[N1,..., Nm]` `m >= 0`, and
          the same dtype as `total_count`. Each entry represents logits for the
          probability of success for independent Binomial distributions. Only one
          of `logits` or `probs` should be passed in.
        probs: Positive floating point tensor with shape broadcastable to
          `[N1,..., Nm]` `m >= 0`, `probs in [0, 1]`. Each entry represents the
          probability of success for independent Binomial distributions. Only one
          of `logits` or `probs` should be passed in.
        validate_args: Python `bool`, default `False`. When `True` distribution
          parameters are checked for validity despite possibly degrading runtime
          performance. When `False` invalid inputs may silently render incorrect
          outputs.
        allow_nan_stats: Python `bool`, default `True`. When `True`, statistics
          (e.g., mean, mode, variance) use the value "`NaN`" to indicate the
          result is undefined. When `False`, an exception is raised if one or
          more of the statistic's batch members are undefined.
        name: Python `str` name prefixed to Ops created by this class.
      """
      parameters = dict(locals())
      if (probs is None) == (logits is None):
          raise ValueError(
              "Construct `Binomial` with `probs` or `logits`, but not both."
          )
      with tf.name_scope(name or "Binomial") as name:
          dtype = dtype_util.common_dtype(
              [total_count, logits, probs], tf.float32
          )
          self._total_count = tensor_util.convert_nonref_to_tensor(
              total_count, dtype=dtype, name="total_count"
          )
          self._logits = tensor_util.convert_nonref_to_tensor(
              logits, dtype=dtype, name="logits"
          )
          self._probs = tensor_util.convert_nonref_to_tensor(
              probs, dtype=dtype, name="probs"
          )
          super(Binomial, self).__init__(
              dtype=dtype,
              reparameterization_type=reparameterization.NOT_REPARAMETERIZED,
              validate_args=validate_args,
              allow_nan_stats=allow_nan_stats,
              parameters=parameters,
              name=name,
          )
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import sigmoid
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import batched_rejection_sampler
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import implementation_selection
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math import special
label_desc: Use image node_id 1 to create a new Binomial object from inherited base classes: distribution, distribution with example: obj = Binomial(total_count, logits, probs, validate_args, allow_nan_stats, name)