class_docstr: Class for using optimization to acquire feature grid.
class_docstr_tok: ["Class","for","using","optimization","to","acquire","feature","grid","."]
docstr: Optimize feature grid.
  
  Args:
    point_coords: [npts, 3] point coordinates.
    point_vals: [npts, 1] point values.
    steps: int, number of steps for gradient descent.
    print_every_n_steps: int, print every n steps.
  Returns:
docstr_tok: ["Optimize","feature","grid",".","Args",":","point_coords",":","[","npts",",","3","]","point","coordinates",".","point_vals",":","[","npts",",","1","]","point","values",".","steps",":","int",",","number","of","steps","for","gradient","descent",".","print_every_n_steps",":","int",",","print","every","n","steps",".","Returns",":"]
code: def optimize_feat_grid(
      self,
      point_coords,
      point_vals,
      steps=10000,
      print_every_n_steps=1000,
  ):
      """Optimize feature grid.
  
      Args:
        point_coords: [npts, 3] point coordinates.
        point_vals: [npts, 1] point values.
        steps: int, number of steps for gradient descent.
        print_every_n_steps: int, print every n steps.
      Returns:
  
      """
      print_every_n_steps = int(print_every_n_steps)
  
      point_coords = point_coords.copy()
      point_vals = np.sign(point_vals.copy())
  
      if point_coords.ndim == 3:
          point_coords = point_coords[0]
      if point_vals.ndim == 3:
          point_vals = point_vals[0]
      elif point_vals.ndim == 1:
          point_vals = point_vals[:, np.newaxis]
  
      # clip
      point_coords = np.clip(point_coords, self.xmin, self.xmax)
  
      # shuffle points
      seq = np.random.permutation(point_coords.shape[0])
      point_coords = point_coords[seq]
      point_vals = point_vals[seq]
  
      point_coords = point_coords[np.newaxis]
      point_vals = point_vals[np.newaxis]
  
      # random point sampling function
      def random_point_sample():
          sid = np.random.choice(point_coords.shape[1] - self.npts + 1)
          eid = sid + self.npts
          return point_coords[:, sid:eid], point_vals[:, sid:eid]
  
      with self.graph.as_default():
          for i in range(steps):
              pc, pv = random_point_sample()
              accu_, loss_, _ = self.sess.run(
                  [self.accu, self.loss, self.train_op],
                  feed_dict={
                      self.point_coords_ph: pc,
                      self.point_values_ph: pv,
                  },
              )
              if i % print_every_n_steps == 0:
                  print(
                      "Step [{:6d}] Accu: {:5.4f} Loss: {:5.4f}".format(
                          i, accu_, loss_
                      )
                  )
  
imports: import os
  import numpy
  from skimage import measure
  import tensorflow.compat.v1
  from tensorflow_graphics.projects.local_implicit_grid.core import evaluator
  from tensorflow_graphics.projects.local_implicit_grid.core import local_implicit_grid_layer
  from tensorflow_graphics.projects.local_implicit_grid.core import point_utils
label_desc: Use image node_id 6 for calling the LIGOptimizer obj's underlying member method code with example usage: obj.optimize_feat_grid(point_coords, point_vals, steps, print_every_n_steps) and returns: point_coords,  point_vals