code: def _validate_block_sizes(block_sizes, bijectors, validate_args):
      """Helper to validate block sizes."""
      block_sizes = ps.convert_to_shape_tensor(
          block_sizes, name="block_sizes", dtype_hint=tf.int32
      )
      block_sizes_shape = block_sizes.shape
      if tensorshape_util.is_fully_defined(block_sizes_shape):
          if tensorshape_util.rank(block_sizes_shape) != 1 or (
              tensorshape_util.num_elements(block_sizes_shape)
              != len(bijectors)
          ):
              raise ValueError(
                  "`block_sizes` must be `None`, or a vector of the same length as "
                  "`bijectors`. Got a `Tensor` with shape {} and `bijectors` of "
                  "length {}".format(block_sizes_shape, len(bijectors))
              )
          return block_sizes
  
      elif validate_args:
          message = (
              "`block_sizes` must be `None`, or a vector of the same length "
              "as `bijectors`."
          )
          with tf.control_dependencies(
              [
                  assert_util.assert_equal(
                      tf.size(block_sizes),
                      len(bijectors),
                      message=message,
                  ),
                  assert_util.assert_equal(tf.rank(block_sizes), 1),
              ]
          ):
              block_sizes = tf.identity(block_sizes)
  
      # Set the shape if missing to pass statically known structure to split.
      tensorshape_util.set_shape(block_sizes, [len(bijectors)])
      return block_sizes
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import composition
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import joint_map
  from tensorflow_probability.python.bijectors import split
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow.python.util import nest
label_desc: Use image node_id 2 for calling a global function with example usage: _validate_block_sizes(block_sizes, bijectors, validate_args) and returns: block_sizes, block_sizes