code: def _batch_sort_vector(x, ascending=True, name=None):
      """Batch sort.  Sorts the -1 dimension of each batch member independently."""
      with tf.name_scope(name or "_batch_sort_vector"):
          x = tf.convert_to_tensor(value=x, name="x")
          n = tf.shape(x)[-1]
          if ascending:
              y, _ = tf.nn.top_k(-x, k=n, sorted=True)
              y = -y
          else:
              y, _ = tf.nn.top_k(x, k=n, sorted=True)
          tensorshape_util.set_shape(y, x.shape)
          return y
  
imports: import functools
  import itertools
  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 tensorshape_util
  from tensorflow_probability.python.util.seed_stream import SeedStream
label_desc: Use image node_id 7 for calling a global function with example usage: _batch_sort_vector(x, ascending, name) and returns: y