# Path: ldif/util/geom_util.py
# def ray_sphere_intersect(ray_start, ray_direction, sphere_center, sphere_radius,
#                          max_t):
# def to_homogeneous(t, is_point):
# def transform_points_with_normals(points, tx, normals=None):
# def transform_featured_points(points, tx):
# def rotation_to_tx(rot):
# def extract_points_near_origin(points, count, features=None):
# def local_views_of_shape(global_points,
#                          world2local,
#                          local_point_count,
#                          global_normals=None,
#                          global_features=None,
#                          zeros_invalid=False,
#                          zero_threshold=1e-6,
#                          expand_region=True,
#                          threshold=4.0):
# def chamfer_distance(pred, target):
# def dodeca_parameters(dodeca_idx):
# def get_camera_to_world(viewpoint, center, world_up):
# def get_dodeca_camera_to_worlds():
# def gaps_depth_render_to_xyz(model_config, depth_image, camera_parameters):
# def angle_of_rotation_to_2d_rotation_matrix(angle_of_rotation):
# def fractional_vector_projection(e0, e1, p, falloff=2.0):
# def rotate_about_point(angle_of_rotation, point, to_rotate):
# def interpolate_from_grid(samples, grid):
# def reflect(samples, reflect_x=False, reflect_y=False, reflect_z=False):
# def z_reflect(samples):
# def get_world_to_camera(idx):
# def transform_depth_dodeca_to_xyz_dodeca(depth_dodeca):
# def transform_depth_dodeca_to_xyz_dodeca_np(depth_dodeca):
# def _unbatch(arr):
# def to_homogenous_np(arr, is_point=True):
# def depth_to_cam_np(im, xfov=0.5):
# def apply_tx_np(samples, tx, is_point=True):
# def depth_image_to_sdf_constraints(im, cam2world, xfov=0.5):
# def depth_dodeca_to_sdf_constraints(depth_ims):
# def depth_dodeca_to_samples(dodeca):
# def depth_image_to_class_constraints(im, cam2world, xfov=0.5):
# def depth_image_to_samples(im, cam2world, xfov=0.5):  # pylint:disable=unused-argument
# def apply_4x4(tensor, tx, are_points=True, batch_rank=None, sample_rank=None):
# def depth_image_to_xyz_image(depth_images, world_to_camera, xfov=0.5):
# def interpolate_from_grid_coordinates(samples, grid):
# 
# Path: ldif/util/image_util.py
# def rgba_to_rgb(model_config, rgba):
# def downsample(images, exp=1):
# def get_border_pixels(gt, threshold=0.1):
# def hessian(sdf_im):
# def summarize_image(gt, pred, name):
# def get_pil_formatted_image(image):
# def images_are_near(baseline_image,
#                     result_image,
#                     max_outlier_fraction=0.005,
#                     pixel_error_threshold=0.04):
# def expect_images_are_near_and_save_comparison(test,
#                                                baseline_image,
#                                                result_image,
#                                                comparison_name,
#                                                images_differ_message,
#                                                max_outlier_fraction=0.005,
#                                                pixel_error_threshold=0.04,
#                                                save_format='.png'):
# def expect_image_file_and_image_are_near(test,
#                                          baseline_path,
#                                          result_image_bytes_or_numpy,
#                                          comparison_name,
#                                          images_differ_message,
#                                          max_outlier_fraction=0.005,
#                                          pixel_error_threshold=0.04,
#                                          resize_baseline_image=None):


import collections
import tensorflow as tf
from ldif.util import geom_util
from ldif.util import image_util
          maxval=19,
          dtype=tf.int32)
    return self._finite_wrapper(self._random_depth_indices)
    # return tf.constant([[2, 5, 3, 4, 9, 14, 17, 20, 1, 11]], dtype=tf.int32)

  @property
  def random_depth_images(self):
    if self._random_depth_images is None:
      self._random_depth_images = select_image(self.depth_renders,
                                               self.random_depth_indices)
    return self._finite_wrapper(self._random_depth_images)

  @property
  def random_depth_to_worlds(self):
    """A shuffled subset of the depth images per batch element."""
    if self._random_depth_to_worlds is None:
      self._random_depth_to_worlds = tf.gather(
          self.depth_to_world,
          tf.reshape(
              self.random_depth_indices,
              [self._model_config.hparams.bs * self._model_config.hparams.rc]))
      self._random_depth_to_worlds = tf.reshape(
          self._random_depth_to_worlds,
          [self._model_config.hparams.bs, self._model_config.hparams.rc, 4, 4])
    return self._finite_wrapper(self._random_depth_to_worlds)

  @property
  def xyz_renders(self):
    if not hasattr(self, '_xyz_renders'):
      self._xyz_renders = add_noise_to_xyz(

# Path: ldif/util/geom_util.py
# def ray_sphere_intersect(ray_start, ray_direction, sphere_center, sphere_radius,
#                          max_t):
# def to_homogeneous(t, is_point):
# def transform_points_with_normals(points, tx, normals=None):
# def transform_featured_points(points, tx):
# def rotation_to_tx(rot):
# def extract_points_near_origin(points, count, features=None):
# def local_views_of_shape(global_points,
#                          world2local,
#                          local_point_count,
#                          global_normals=None,
#                          global_features=None,
#                          zeros_invalid=False,
#                          zero_threshold=1e-6,
#                          expand_region=True,
#                          threshold=4.0):
# def chamfer_distance(pred, target):
# def dodeca_parameters(dodeca_idx):
# def get_camera_to_world(viewpoint, center, world_up):
# def get_dodeca_camera_to_worlds():
# def gaps_depth_render_to_xyz(model_config, depth_image, camera_parameters):
# def angle_of_rotation_to_2d_rotation_matrix(angle_of_rotation):
# def fractional_vector_projection(e0, e1, p, falloff=2.0):
# def rotate_about_point(angle_of_rotation, point, to_rotate):
# def interpolate_from_grid(samples, grid):
# def reflect(samples, reflect_x=False, reflect_y=False, reflect_z=False):
# def z_reflect(samples):
# def get_world_to_camera(idx):
# def transform_depth_dodeca_to_xyz_dodeca(depth_dodeca):
# def transform_depth_dodeca_to_xyz_dodeca_np(depth_dodeca):
# def _unbatch(arr):
# def to_homogenous_np(arr, is_point=True):
# def depth_to_cam_np(im, xfov=0.5):
# def apply_tx_np(samples, tx, is_point=True):
# def depth_image_to_sdf_constraints(im, cam2world, xfov=0.5):
# def depth_dodeca_to_sdf_constraints(depth_ims):
# def depth_dodeca_to_samples(dodeca):
# def depth_image_to_class_constraints(im, cam2world, xfov=0.5):
# def depth_image_to_samples(im, cam2world, xfov=0.5):  # pylint:disable=unused-argument
# def apply_4x4(tensor, tx, are_points=True, batch_rank=None, sample_rank=None):
# def depth_image_to_xyz_image(depth_images, world_to_camera, xfov=0.5):
# def interpolate_from_grid_coordinates(samples, grid):
# 
# Path: ldif/util/image_util.py
# def rgba_to_rgb(model_config, rgba):
# def downsample(images, exp=1):
# def get_border_pixels(gt, threshold=0.1):
# def hessian(sdf_im):
# def summarize_image(gt, pred, name):
# def get_pil_formatted_image(image):
# def images_are_near(baseline_image,
#                     result_image,
#                     max_outlier_fraction=0.005,
#                     pixel_error_threshold=0.04):
# def expect_images_are_near_and_save_comparison(test,
#                                                baseline_image,
#                                                result_image,
#                                                comparison_name,
#                                                images_differ_message,
#                                                max_outlier_fraction=0.005,
#                                                pixel_error_threshold=0.04,
#                                                save_format='.png'):
# def expect_image_file_and_image_are_near(test,
#                                          baseline_path,
#                                          result_image_bytes_or_numpy,
#                                          comparison_name,
#                                          images_differ_message,
#                                          max_outlier_fraction=0.005,
#                                          pixel_error_threshold=0.04,
#                                          resize_baseline_image=None):


# Path: ldif/datasets/shapenet.py
import collections
import tensorflow as tf
from ldif.util import geom_util
from ldif.util import image_util

          maxval=19,
          dtype=tf.int32)
    return self._finite_wrapper(self._random_depth_indices)
    # return tf.constant([[2, 5, 3, 4, 9, 14, 17, 20, 1, 11]], dtype=tf.int32)

  @property
  def random_depth_images(self):
    if self._random_depth_images is None:
      self._random_depth_images = select_image(self.depth_renders,
                                               self.random_depth_indices)
    return self._finite_wrapper(self._random_depth_images)

  @property
  def random_depth_to_worlds(self):
    """A shuffled subset of the depth images per batch element."""
    if self._random_depth_to_worlds is None:
      self._random_depth_to_worlds = tf.gather(
          self.depth_to_world,
          tf.reshape(
              self.random_depth_indices,
              [self._model_config.hparams.bs * self._model_config.hparams.rc]))
      self._random_depth_to_worlds = tf.reshape(
          self._random_depth_to_worlds,
          [self._model_config.hparams.bs, self._model_config.hparams.rc, 4, 4])
    return self._finite_wrapper(self._random_depth_to_worlds)

  @property
  def xyz_renders(self):
    if not hasattr(self, '_xyz_renders'):
      self._xyz_renders = add_noise_to_xyz(

          geom_util.transform_depth_dodeca_to_xyz_dodeca(self.depth_renders),