code: def _assert_bounds_is_vector(v, name):
      rank_ = tf.get_static_value(ps.rank(v))
      if rank_ is None:
          with tf.control_dependencies(
              [tf.assert_rank(v, 1, f"`{name}` must be a vector.")]
          ):
              v = tf.identity(v)
      else:
          if rank_ != 1:
              raise ValueError(
                  f"`{name}` must be a vector, saw: {ps.shape(v)}"
              )
      return v
  
imports: import functools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.math import interpolation
label_desc: Use image node_id 1 for calling a global function with example usage: _assert_bounds_is_vector(v, name) and returns: v