code: def np_pad_points(points, ntarget):
      """Pad point cloud to required size.
  
      If number of points is larger than ntarget, take ntarget random samples.
      If number of points is smaller than ntarget, pad by repeating last point.
      Args:
        points: `[npoints, nchannel]` np array, where first 3 channels are xyz.
        ntarget: int, number of target channels.
      Returns:
        result: `[ntarget, nchannel]` np array, padded points to ntarget numbers.
      """
      if points.shape[0] < ntarget:
          mult = np.ceil(float(ntarget) / float(points.shape[0])) - 1
          rand_pool = np.tile(points, [int(mult), 1])
          nextra = ntarget - points.shape[0]
          extra_idx = np.random.choice(
              rand_pool.shape[0], nextra, replace=False
          )
          extra_pts = rand_pool[extra_idx]
          points_out = np.concatenate([points, extra_pts], axis=0)
      else:
          idx_choice = np.random.choice(
              points.shape[0], size=ntarget, replace=False
          )
          points_out = points[idx_choice]
  
      return points_out
  
file_path: graphics/tensorflow_graphics/projects/local_implicit_grid/core/point_utils.py
imports: import numpy
  from plyfile import PlyData
  from plyfile import PlyElement
label_desc: Use image node_id 3 for calling a global function with example usage: np_pad_points(points, ntarget) and returns: points_out