code: def uniform_1d(
      near: TensorLike,
      far: TensorLike,
      num_samples: int,
      name="uniform_1d",
  ) -> tf.Tensor:
      """Sample uniformly numbers on an interval, with the numbers being sorted.
  
      Args:
        near: A tensor of shape `[A1, ... An]` containing the starting points of
          the sampling interval.
        far: A tensor of shape `[A1, ... An]` containing the ending points of
          the sampling interval.
        num_samples: The number M of points to be sampled.
        name:  A name for this op that defaults to "uniform_1d".
  
      Returns:
        A tensor of shape `[A1, ..., An, M]` indicating the M points on the ray
      """
      with tf.name_scope(name):
          near = tf.convert_to_tensor(near)
          far = tf.convert_to_tensor(far)
  
          shape.compare_batch_dimensions(
              tensors=(
                  tf.expand_dims(near, axis=-1),
                  tf.expand_dims(far, axis=-1),
              ),
              tensor_names=("near", "far"),
              last_axes=-1,
              broadcast_compatible=True,
          )
  
          target_shape = tf.concat(
              [tf.shape(near), [num_samples]], axis=-1
          )
          random_samples = tf.random.uniform(
              target_shape,
              minval=tf.expand_dims(near, -1),
              maxval=tf.expand_dims(far, -1),
          )
          return tf.sort(random_samples, axis=-1)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tensorflow_graphics.util import export_api
  from tensorflow_graphics.util import safe_ops
  from tensorflow_graphics.util import shape
  from tensorflow_graphics.util.type_alias import TensorLike
label_desc: Use image node_id 3 for calling a global function with example usage: uniform_1d(near, far, num_samples, name) and returns: tf