code: def broadcasting_named_shapes(draw, batch_shape, param_names):
      """Strategy for drawing a set of batch shapes that broadcast to `batch_shape`.
  
      For each parameter we need to choose its batch rank, and whether or not each
      axis i is 1 or batch_shape[i]. This function chooses a set of shapes that
      have possibly mismatched ranks, and possibly broadcasting axes, with the
      promise that the broadcast of the set of all shapes matches `batch_shape`.
  
      Args:
        draw: Hypothesis strategy sampler supplied by `@hps.composite`.
        batch_shape: `tf.TensorShape`, the target (fully-defined) batch shape.
        param_names: Iterable of `str`, the parameters whose batch shapes need
          determination.
  
      Returns:
        param_batch_shapes: A strategy for drawing `dict`s of `str->tf.TensorShape`
          where the set of shapes broadcast to `batch_shape`. The shapes are fully
          defined.
      """
      n = len(param_names)
      return dict(
          zip(
              draw(hps.permutations(param_names)),
              draw(
                  broadcasting_shapes(
                      batch_shape, n, no_error_n_eq_1=True
                  )
              ),
          )
      )
  
imports: import contextlib
  import os
  import re
  import traceback
  import unittest
  import hypothesis
  from hypothesis.extra import numpy
  import hypothesis.strategies
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.util.deferred_tensor import DeferredTensor
label_desc: Use image node_id 24 for calling a global function with example usage: broadcasting_named_shapes(draw, batch_shape, param_names) and returns: dict