code: def broadcasting_shapes(draw, target_shape, n, no_error_n_eq_1=False):
      """Strategy for drawing a set of `n` shapes that broadcast to `target_shape`.
  
      For each shape we need to choose its rank, and whether or not each axis i is 1
      or target_shape[i]. This function chooses a set of `n` shapes that have
      possibly mismatched ranks, and possibly broadcasting axes, with the promise
      that the broadcast of the set of all shapes matches `target_shape`.
  
      Args:
        draw: Hypothesis strategy sampler supplied by `@hps.composite`.
        target_shape: The target (fully-defined) batch shape.
        n: Python `int`, the number of shapes to draw.
        no_error_n_eq_1: If True, don't raise ValueError when n==1.
  
      Returns:
        shapes: A strategy for drawing sequences of `tf.TensorShape` such that the
          set of shapes in each sequence broadcast to `target_shape`. The shapes are
          fully defined.
      """
      if n == 1 and not no_error_n_eq_1:
          raise ValueError(
              "`broadcasting_shapes(shp, n=1) is just `shp`. "
              "Did you want `broadcast_compatible_shape`? If `n` "
              "is stochastic, add arg `no_error_n_eq_1=True`."
          )
      target_shape = tf.TensorShape(target_shape)
      target_rank = tensorshape_util.rank(target_shape)
      result = []
      current_shape = tf.TensorShape([])
      for is_last in [False] * (n - 1) + [True]:
          (
              next_rank,
              force_fullsize_dim,
          ) = _compute_rank_and_fullsize_reqd(
              draw, target_shape, current_shape, is_last=is_last
          )
  
          # Get the last next_rank (possibly 0!) dimensions.
          next_shape = tensorshape_util.as_list(
              target_shape[target_rank - next_rank :]
          )
          for i, force_fullsize in enumerate(force_fullsize_dim):
              if not force_fullsize and draw(hps.booleans()):
                  # Choose to make this param broadcast against some other param.
                  next_shape[i] = 1
          next_shape = tf.TensorShape(next_shape)
          current_shape = tf.broadcast_static_shape(
              current_shape, next_shape
          )
          result.append(next_shape)
      return result
  
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 27 for calling a global function with example usage: broadcasting_shapes(draw, target_shape, n, no_error_n_eq_1) and returns: result