code: def index_points(points, idx):
      """
      Input:
          points: input points data, [B, N, C]
          idx: sample index data, [B, S]
      Return:
          new_points:, indexed points data, [B, S, C]
      """
      device = points.device
      B = points.shape[0]
      view_shape = list(idx.shape)
      view_shape[1:] = [1] * (len(view_shape) - 1)
      repeat_shape = list(idx.shape)
      repeat_shape[0] = 1
      batch_indices = (
          torch.arange(B, dtype=torch.long)
          .to(device)
          .view(view_shape)
          .repeat(repeat_shape)
      )
      new_points = points[batch_indices, idx, :]
      return new_points
  
imports: import numpy
  import matplotlib.pyplot
  from mpl_toolkits.mplot3d import Axes3D
  import random
  import torch
  import torch.nn
  import torch.nn.functional
  import os
  from collections import abc
label_desc: Use image node_id 1 for calling a global function with example usage: index_points(points, idx) and returns: new_points