class_docstr: The Batch-Reshaping distribution.
  
  This "meta-distribution" reshapes the batch dimensions of another
  distribution.
  
  #### Examples
  
  ```python
  tfd = tfp.distributions
  
  dtype = np.float32
  dims = 2
  new_batch_shape = [1, 2, -1]
  old_batch_shape = [6]
  
  scale = np.ones(old_batch_shape + [dims], dtype)
  mvn = tfd.MultivariateNormalDiag(scale_diag=scale)
  reshape_mvn = tfd.BatchReshape(
      distribution=mvn,
      batch_shape=new_batch_shape,
      validate_args=True)
  
  reshape_mvn.batch_shape
  # ==> [1, 2, 3]
  
  x = reshape_mvn.sample(sample_shape=[4, 5])
  x.shape
  # ==> [4, 5, 1, 2, 3, 2] == sample_shape + new_batch_shape + [dims]
  
  reshape_mvn.log_prob(x).shape
  # ==> [4, 5, 1, 2, 3] == sample_shape + new_batch_shape
  ```
class_docstr_tok: ["The","Batch-Reshaping","distribution",".","This","``","meta-distribution","''","reshapes","the","batch","dimensions","of","another","distribution",".","#","#","#","#","Examples","``","`","python","tfd","=","tfp.distributions","dtype","=","np.float32","dims","=","2","new_batch_shape","=","[","1",",","2",",","-1","]","old_batch_shape","=","[","6","]","scale","=","np.ones","(","old_batch_shape","+","[","dims","]",",","dtype",")","mvn","=","tfd.MultivariateNormalDiag","(","scale_diag=scale",")","reshape_mvn","=","tfd.BatchReshape","(","distribution=mvn",",","batch_shape=new_batch_shape",",","validate_args=True",")","reshape_mvn.batch_shape","#","==",">","[","1",",","2",",","3","]","x","=","reshape_mvn.sample","(","sample_shape=","[","4",",","5","]",")","x.shape","#","==",">","[","4",",","5",",","1",",","2",",","3",",","2","]","==","sample_shape","+","new_batch_shape","+","[","dims","]","reshape_mvn.log_prob","(","x",")",".shape","#","==",">","[","4",",","5",",","1",",","2",",","3","]","==","sample_shape","+","new_batch_shape","``","`"]
docstr: Calls `fn` and appropriately reshapes its output.
docstr_tok: ["Calls","`","fn","`","and","appropriately","reshapes","its","output","."]
code: def _call_and_reshape_output(
      self,
      fn,
      event_shape_list=None,
      static_event_shape_list=None,
      extra_kwargs=None,
  ):
      """Calls `fn` and appropriately reshapes its output."""
      # Note: we take `extra_kwargs` as a dict rather than `**extra_kwargs`
      # because it is possible the user provided extra kwargs would itself
      # have `fn`, `event_shape_list`, `static_event_shape_list` and/or
      # `extra_kwargs` as keys.
      if event_shape_list is None:
          event_shape_list = [self._event_shape_tensor()]
      if static_event_shape_list is None:
          static_event_shape_list = [self.event_shape]
      new_shape = ps.concat(
          [self._batch_shape_unexpanded] + event_shape_list, axis=0
      )
      result = tf.reshape(
          fn(**extra_kwargs) if extra_kwargs else fn(), new_shape
      )
      if (
          tensorshape_util.rank(self.batch_shape) is not None
          and tensorshape_util.rank(self.event_shape) is not None
      ):
          event_shape = tf.TensorShape([])
          for rss in static_event_shape_list:
              event_shape = tensorshape_util.concatenate(
                  event_shape, rss
              )
          static_shape = tensorshape_util.concatenate(
              self.batch_shape, event_shape
          )
          tensorshape_util.set_shape(result, static_shape)
      return result
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import dtype_util
  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.python.util import nest
label_desc: Use image node_id 28 for calling the _BatchReshape obj's underlying member method code with example usage: obj._call_and_reshape_output(fn, event_shape_list, static_event_shape_list, extra_kwargs) and returns: result