code: def inferred_batch_shape(batch_object, bijector_x_event_ndims=None):
      """Infers an object's batch shape from its  parameters.
  
      Each parameter contributes a batch shape of
      `base_shape(parameter)[:-event_ndims(parameter)]`, where a parameter's
      `base_shape` is its batch shape if it defines one (e.g., if it is a
      Distribution, LinearOperator, etc.), and its Tensor shape otherwise,
      and `event_ndims` is as annotated by
      `batch_object.parameter_properties()[parameter_name].event_ndims`.
      Parameters with structured batch shape
      (in particular, non-autobatched JointDistributions) are not currently
      supported.
  
      Args:
        batch_object: Python object, typically a `tfd.Distribution` or
          `tfb.Bijector`. This must implement the method
          `batched_object.parameter_properties()` and expose a dict
          `batched_object.parameters` of the parameters passed to its constructor.
        bijector_x_event_ndims: If `batch_object` is a bijector, this is the
          (structure of) integer(s) value of `x_event_ndims` in the current context
          (for example, as passed to `experimental_batch_shape`). Otherwise, this
          argument should be `None`.
          Default value: `None`.
  
      Returns:
        batch_shape: `tf.TensorShape` broadcast batch shape of all parameters; may
            be partially defined or unknown.
      """
      batch_shapes = map_fn_over_parameters_with_event_ndims(
          batch_object,
          get_batch_shape_part,
          require_static=True,
          bijector_x_event_ndims=bijector_x_event_ndims,
      )
      return functools.reduce(
          tf.broadcast_static_shape,
          tf.nest.flatten(batch_shapes),
          tf.TensorShape([]),
      )
  
file_path: probability/tensorflow_probability/python/internal/batch_shape_lib.py
imports: import functools
  from absl import logging
  import numpy
  import tensorflow.compat.v2
  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 1 for calling a global function with example usage: inferred_batch_shape(batch_object, bijector_x_event_ndims) and returns: functools