class_docstr: Independent distribution from batch of distributions.
  
  This distribution is useful for regarding a collection of independent,
  non-identical distributions as a single random variable. For example, the
  `Independent` distribution composed of a collection of `Bernoulli`
  distributions might define a distribution over an image (where each
  `Bernoulli` is a distribution over each pixel).
  
  More precisely, a collection of `B` (independent) `E`-variate random variables
  (rv) `{X_1, ..., X_B}`, can be regarded as a `[B, E]`-variate random variable
  `(X_1, ..., X_B)` with probability
  `p(x_1, ..., x_B) = p_1(x_1) * ... * p_B(x_B)` where `p_b(X_b)` is the
  probability of the `b`-th rv. More generally `B, E` can be arbitrary shapes.
  
  Similarly, the `Independent` distribution specifies a distribution over `[B,
  E]`-shaped events. It operates by reinterpreting the rightmost batch dims as
  part of the event dimensions. The `reinterpreted_batch_ndims` parameter
  controls the number of batch dims which are absorbed as event dims;
  `reinterpreted_batch_ndims <= len(batch_shape)`.  For example, the `log_prob`
  function entails a `reduce_sum` over the rightmost `reinterpreted_batch_ndims`
  after calling the base distribution's `log_prob`.  In other words, since the
  batch dimension(s) index independent distributions, the resultant multivariate
  will have independent components.
  
  #### Mathematical Details
  
  The probability function is,
  
  ```none
  prob(x; reinterpreted_batch_ndims) = tf.reduce_prod(
      dist.prob(x),
      axis=-1-range(reinterpreted_batch_ndims))
  ```
  
  #### Examples
  
  ```python
  tfd = tfp.distributions
  
  # Make independent distribution from a 2-batch Normal.
  ind = tfd.Independent(
      distribution=tfd.Normal(loc=[-1., 1], scale=[0.1, 0.5]),
      reinterpreted_batch_ndims=1)
  
  # All batch dims have been 'absorbed' into event dims.
  ind.batch_shape  # ==> []
  ind.event_shape  # ==> [2]
  
  # Make independent distribution from a 2-batch bivariate Normal.
  ind = tfd.Independent(
      distribution=tfd.MultivariateNormalDiag(
          loc=[[-1., 1], [1, -1]],
          scale_diag=tf.tile([[1.], [0.5]], [1, 2]),
      reinterpreted_batch_ndims=1)
  
  # All batch dims have been 'absorbed' into event dims.
  ind.batch_shape  # ==> []
  ind.event_shape  # ==> [2, 2]
  ```
class_docstr_tok: ["Independent","distribution","from","batch","of","distributions",".","This","distribution","is","useful","for","regarding","a","collection","of","independent",",","non-identical","distributions","as","a","single","random","variable",".","For","example",",","the","`","Independent","`","distribution","composed","of","a","collection","of","`","Bernoulli","`","distributions","might","define","a","distribution","over","an","image","(","where","each","`","Bernoulli","`","is","a","distribution","over","each","pixel",")",".","More","precisely",",","a","collection","of","`","B","`","(","independent",")","`","E","`","-variate","random","variables","(","rv",")","`","{","X_1",",","...",",","X_B","}","`",",","can","be","regarded","as","a","`","[","B",",","E","]","`","-variate","random","variable","`","(","X_1",",","...",",","X_B",")","`","with","probability","`","p","(","x_1",",","...",",","x_B",")","=","p_1","(","x_1",")","*","...","*","p_B","(","x_B",")","`","where","`","p_b","(","X_b",")","`","is","the","probability","of","the","`","b","`","-th","rv",".","More","generally","`","B",",","E","`","can","be","arbitrary","shapes",".","Similarly",",","the","`","Independent","`","distribution","specifies","a","distribution","over","`","[","B",",","E","]","`","-shaped","events",".","It","operates","by","reinterpreting","the","rightmost","batch","dims","as","part","of","the","event","dimensions",".","The","`","reinterpreted_batch_ndims","`","parameter","controls","the","number","of","batch","dims","which","are","absorbed","as","event","dims",";","`","reinterpreted_batch_ndims","<","=","len","(","batch_shape",")","`",".","For","example",",","the","`","log_prob","`","function","entails","a","`","reduce_sum","`","over","the","rightmost","`","reinterpreted_batch_ndims","`","after","calling","the","base","distribution","'s","`","log_prob","`",".","In","other","words",",","since","the","batch","dimension","(","s",")","index","independent","distributions",",","the","resultant","multivariate","will","have","independent","components",".","#","#","#","#","Mathematical","Details","The","probability","function","is",",","``","`","none","prob","(","x",";","reinterpreted_batch_ndims",")","=","tf.reduce_prod","(","dist.prob","(","x",")",",","axis=-1-range","(","reinterpreted_batch_ndims",")",")","``","`","#","#","#","#","Examples","``","`","python","tfd","=","tfp.distributions","#","Make","independent","distribution","from","a","2-batch","Normal",".","ind","=","tfd.Independent","(","distribution=tfd.Normal","(","loc=","[","-1.",",","1","]",",","scale=","[","0.1",",","0.5","]",")",",","reinterpreted_batch_ndims=1",")","#","All","batch","dims","have","been","'absorbed","'","into","event","dims",".","ind.batch_shape","#","==",">","[","]","ind.event_shape","#","==",">","[","2","]","#","Make","independent","distribution","from","a","2-batch","bivariate","Normal",".","ind","=","tfd.Independent","(","distribution=tfd.MultivariateNormalDiag","(","loc=","[","[","-1.",",","1","]",",","[","1",",","-1","]","]",",","scale_diag=tf.tile","(","[","[","1",".","]",",","[","0.5","]","]",",","[","1",",","2","]",")",",","reinterpreted_batch_ndims=1",")","#","All","batch","dims","have","been","'absorbed","'","into","event","dims",".","ind.batch_shape","#","==",">","[","]","ind.event_shape","#","==",">","[","2",",","2","]","``","`"]
code: def _mean(self, **kwargs):
      return self.distribution.mean(**kwargs)
  
imports: import collections
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import log_prob_ratio
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math import generic
  from tensorflow.python.util import deprecation
label_desc: Use image node_id 19 for calling the _Independent obj's underlying member method code with example usage: obj._mean() and returns: self