class_docstr: Evaluate sparse encoded feature grids.
class_docstr_tok: ["Evaluate","sparse","encoded","feature","grids","."]
docstr: Evaluate feature grid.
  
  Args:
    feature_grid: [*grid_size, codelen] np.array, feature grid to evaluate.
    mask: [*grid_size] bool np.array, mask for feature locations.
    res_per_part: int, resolution of output evaluation per part.
    conservative: bool, whether to do conservative evaluations.
    If true, evalutes a cell if either neighbor is masked. Else, evaluates a
    cell if all neighbors are masked.
  Returns:
    output grid.
docstr_tok: ["Evaluate","feature","grid",".","Args",":","feature_grid",":","[","*","grid_size",",","codelen","]","np.array",",","feature","grid","to","evaluate",".","mask",":","[","*","grid_size","]","bool","np.array",",","mask","for","feature","locations",".","res_per_part",":","int",",","resolution","of","output","evaluation","per","part",".","conservative",":","bool",",","whether","to","do","conservative","evaluations",".","If","true",",","evalutes","a","cell","if","either","neighbor","is","masked",".","Else",",","evaluates","a","cell","if","all","neighbors","are","masked",".","Returns",":","output","grid","."]
code: def evaluate_feature_grid(
      self, feature_grid, mask, res_per_part=4, conservative=False
  ):
      """Evaluate feature grid.
  
      Args:
        feature_grid: [*grid_size, codelen] np.array, feature grid to evaluate.
        mask: [*grid_size] bool np.array, mask for feature locations.
        res_per_part: int, resolution of output evaluation per part.
        conservative: bool, whether to do conservative evaluations.
        If true, evalutes a cell if either neighbor is masked. Else, evaluates a
        cell if all neighbors are masked.
      Returns:
        output grid.
      """
      # setup grid
      eps = 1e-6
      s = self.res
      l = [
          np.linspace(
              self.xmin[i] + eps,
              self.xmax[i] - eps,
              res_per_part * s[i],
          )
          for i in range(3)
      ]
      xyz = np.stack(
          np.meshgrid(l[0], l[1], l[2], indexing="ij"), axis=-1
      ).reshape(-1, 3)
      output_grid = np.ones(
          [
              res_per_part * s[0],
              res_per_part * s[1],
              res_per_part * s[2],
          ],
          dtype=np.float32,
      ).reshape(-1)
      mask = mask.astype(bool)
      if self.overlap:
          mask = np.stack(
              [
                  mask[:-1, :-1, :-1],
                  mask[:-1, :-1, 1:],
                  mask[:-1, 1:, :-1],
                  mask[:-1, 1:, 1:],
                  mask[1:, :-1, :-1],
                  mask[1:, :-1, 1:],
                  mask[1:, 1:, :-1],
                  mask[1:, 1:, 1:],
              ],
              axis=-1,
          )
          if conservative:
              mask = np.any(mask, axis=-1)
          else:
              mask = np.all(mask, axis=-1)
  
      g = np.stack(
          np.meshgrid(
              np.arange(mask.shape[0]),
              np.arange(mask.shape[1]),
              np.arange(mask.shape[2]),
              indexing="ij",
          ),
          axis=-1,
      ).reshape(-1, 3)
      g = (
          g[:, 0] * (mask.shape[1] * mask.shape[2])
          + g[:, 1] * mask.shape[2]
          + g[:, 2]
      )
      g_valid = g[mask.ravel()]
  
      if self.overlap:
          ijk = np.floor((xyz - self.xmin) / self.part_size * 2).astype(
              np.int32
          )
      else:
          ijk = np.floor(
              (xyz - self.xmin + 0.5 * self.part_size) / self.part_size
          ).astype(np.int32)
      ijk_idx = (
          ijk[:, 0] * (mask.shape[1] * mask.shape[2])
          + ijk[:, 1] * mask.shape[2]
          + ijk[:, 2]
      )
      pt_mask = np.isin(ijk_idx, g_valid)
  
      output_grid[pt_mask] = self.lvg.eval_points(
          feature_grid, xyz[pt_mask]
      )
      output_grid = output_grid.reshape(
          res_per_part * s[0],  # pylint: disable=too-many-function-args
          res_per_part * s[1],
          res_per_part * s[2],
      )
      return output_grid
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import ast
  import numpy
  import tensorflow.compat.v1
  from tensorflow.compat.v1.io import gfile
  from tensorflow_graphics.projects.local_implicit_grid.core import implicit_nets
  from tensorflow_graphics.projects.local_implicit_grid.core import local_implicit_grid_layer
  from tensorflow_graphics.projects.local_implicit_grid.core import model_g2g
  from tensorflow_graphics.projects.local_implicit_grid.core import model_g2v
label_desc: Use image node_id 2 for calling the SparseLIGEvaluator obj's underlying member method code with example usage: obj.evaluate_feature_grid(feature_grid, mask, res_per_part, conservative) and returns: output_grid