code: def inverse_transform_sampling_1d(
      bins: TensorLike,
      pdf: TensorLike,
      num_samples: int,
      name="inverse_transform_sampling_1d",
  ) -> tf.Tensor:
      """Sampling 1D points from a distribution using the inverse transform.
  
         The target distrubution is defined by its probability density function and
         the spatial 1D location of its bins. The new random samples correspond to
         the centers of the bins.
  
      Args:
        bins: A tensor of shape `[A1, ..., An, M]` containing 1D location of M bins.
          For example, a tensor [a, b, c, d] corresponds to
          the bin structure |--a--|-b-|--c--|d|.
        pdf: A tensor of shape `[A1, ..., An, M]` containing the probability
          distribution in M bins.
        num_samples: The number N of new samples.
        name:  A name for this op that defaults to "inverse_transform_sampling_1d".
  
      Returns:
        A tensor of shape `[A1, ..., An, N]` indicating the new N random points.
      """
  
      with tf.name_scope(name):
          bins = tf.convert_to_tensor(value=bins)
          pdf = tf.convert_to_tensor(value=pdf)
  
          shape.check_static(
              tensor=bins, tensor_name="bins", has_rank_greater_than=0
          )
          shape.check_static(
              tensor=pdf, tensor_name="pdf", has_rank_greater_than=0
          )
          shape.compare_batch_dimensions(
              tensors=(bins, pdf),
              tensor_names=("bins", "pdf"),
              last_axes=-2,
              broadcast_compatible=True,
          )
          shape.compare_dimensions(
              tensors=(bins, pdf), tensor_names=("bins", "pdf"), axes=-1
          )
          # Do not consider the last bin, as the cdf contains has +1 dimension.
          pdf = _normalize_pdf(pdf[..., :-1])
          cdf = _get_cdf(pdf)
          batch_shape = tf.shape(pdf)[:-1]
          # TODO(krematas): Use dynamic values
          batch_dims = tf.get_static_value(tf.rank(pdf) - 1)
          target_shape = tf.concat(
              [batch_shape, [num_samples]], axis=-1
          )
          uniform_samples = tf.random.uniform(target_shape)
          bin_indices = tf.searchsorted(
              cdf, uniform_samples, side="right"
          )
          bin_indices = tf.maximum(0, bin_indices - 1)
          z_values = tf.gather(
              bins, bin_indices, axis=-1, batch_dims=batch_dims
          )
          return z_values
  
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 11 for calling a global function with example usage: inverse_transform_sampling_1d(bins, pdf, num_samples, name) and returns: z_values