code: def _broadcast_to_full_batch_shape_helper(
      data, event_ndims, batch_shape, sample_ndims=0
  ):
      """Broadcasts `[sample, ?, event]` to `[sample, batch, event]`."""
      if data is None:
          return None
      data_shape = ps.shape(data)
      data_rank = ps.rank_from_shape(data_shape)
      batch_ndims = ps.rank_from_shape(batch_shape)
  
      # Reshape the data to have full batch rank. For example, given
      # `batch_shape==[3, 2]`, this would reshape `data.shape==[S, 2, E]` to
      # `[S, 1, 2, E]`).
      # This reshaping is not necessary when `sample_ndims==0`, since with no sample
      # dimensions the batch shape itself is leftmost and can broadcast. For
      # example, we would not need to reshape `[2, E] -> [1, 2, E]`.
      if sample_ndims != 0:
          padding_ndims = batch_ndims - (
              data_rank - sample_ndims - event_ndims
          )
          padded_shape = ps.concat(
              [
                  data_shape[:sample_ndims],
                  ps.ones([padding_ndims], dtype=np.int32),
                  data_shape[sample_ndims:],
              ],
              axis=0,
          )
          data = tf.reshape(data, padded_shape)
          data_shape = padded_shape
          data_rank = ps.rank_from_shape(data_shape)
  
      # Broadcast the data to have full batch shape. For example, given
      # `batch_shape==[3, 2]`, this would broadcast `data.shape==[S, 1, 2, E]` to
      # `[S, 3, 2, E]`.
      new_shape = ps.concat(
          [
              data_shape[:sample_ndims],
              batch_shape,
              data_shape[data_rank - event_ndims :],
          ],
          axis=0,
      )
      return tf.broadcast_to(data, new_shape)
  
imports: import collections
  import functools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.math import linalg
  from tensorflow_probability.python.math.scan_associative import scan_associative
label_desc: Use image node_id 13 for calling a global function with example usage: _broadcast_to_full_batch_shape_helper(data, event_ndims, batch_shape, sample_ndims) and returns: tf, None