parameters: (pixel_coords, render_ranges, face_vertices_z,
                           face_vertices_image, face_features, knum=300)
return_statement: return image_features, face_idx
docstring: r"""Fully differentiable volumetric renderer devised by *Gao et al.* in
      `Learning Deformable Tetrahedral Meshes for 3D Reconstruction`_ NeurIPS 2020.
  
      This is rasterizing a mesh w.r.t to a list of pixel coordinates,
      but instead of just rendering the closest intersection.
      it will render all the intersections sorted by depth order,
      returning the interpolated features and the indexes of faces intersected
      for each intersection in padded arrays.
  
      Note:
          The function is not differentiable w.r.t pixel_coords.
  
      Note:
           if `face_camera_vertices` and `face_camera_z` are produced by
           camera functions in :mod:`kaolin.render.camera`,
           then the expected range of values for `pixel_coords` is [-1., 1.]
           and the expected of range values for `render_range` is [-inf, 0.].
  
      Args:
          pixel_coords (torch.Tensor):
              Image coordinates to render,
              of shape :math:`(\text{batch_size}, \text{num_pixels}, 2)`.
          render_ranges (torch.Tensor):
              Depth ranges on which intersection get rendered,
              of shape :math:`(\text{batch_size}, \text{num_pixels}, 2)`.
          face_vertices_z (torch.Tensor):
              3D points values of the face vertices in camera coordinate,
              values in front of camera are expected to be negative,
              higher values being closer to the camera.
              of shape :math:`(\text{batch_size}, \text{num_faces}, 3)`.
          face_vertices_image (torch.Tensor):
              2D positions of the face vertices on image plane,
              of shape :math:`(\text{batch_size}, \text{num_faces}, 3, 2)`,
              Note that face vertices are projected on image plane (z=-1)
              to forms face_vertices_image.
          face_features (torch.Tensor or list of torch.Tensor):
              Features (per-vertex per-face) to be drawn,
              of shape :math:`(\text{batch_size}, \text{num_faces}, 3, \text{feature_dim})`,
              feature is the features dimension,
              for instance with vertex colors num_features=3 (R, G, B),
              and texture coordinates num_features=2 (X, Y),
              or a list of num_features,
              of shapes :math:`(\text{batch_size}, \text{num_faces}, 3, \text{feature_dim[i]})`.
          knum (int):
              Maximum number of faces that influence one pixel. Default: 300.
  
      Returns:
          (torch.Tensor or list of torch.Tensor, torch.LongTensor):
  
              - The rendered features, of shape
                :math:`(\text{batch_size}, \text{num_pixels}, \text{knum}, \text{feature_dim})`,
                if `face_features` is a list of torch.Tensor,
                then it returns a list of torch.Tensor, of shapes
                :math:`(\text{batch_size}, \text{num_pixels}, \text{knum}, \text{feature_dim[i]})`.
              - The rendered face index, -1 is void, of shape
                :math:`(\text{batch_size}, \text{num_pixels}, \text{knum})`.
  
      .. _Learning Deformable Tetrahedral Meshes for 3D Reconstruction:
              https://arxiv.org/abs/2011.01437
docstring_summary: r"""Fully differentiable volumetric renderer devised by *Gao et al.* in
      `Learning Deformable Tetrahedral Meshes for 3D Reconstruction`_ NeurIPS 2020.
docstring_tokens: r Fully differentiable volumetric renderer devised by * Gao et al . * in Learning Deformable Tetrahedral Meshes for 3D Reconstruction _ NeurIPS 2020 .
function: def deftet_sparse_render(pixel_coords, render_ranges, face_vertices_z,
                           face_vertices_image, face_features, knum=300):
      r"""Fully differentiable volumetric renderer devised by *Gao et al.* in
      `Learning Deformable Tetrahedral Meshes for 3D Reconstruction`_ NeurIPS 2020.
  
      This is rasterizing a mesh w.r.t to a list of pixel coordinates,
      but instead of just rendering the closest intersection.
      it will render all the intersections sorted by depth order,
      returning the interpolated features and the indexes of faces intersected
      for each intersection in padded arrays.
  
      Note:
          The function is not differentiable w.r.t pixel_coords.
  
      Note:
           if `face_camera_vertices` and `face_camera_z` are produced by
           camera functions in :mod:`kaolin.render.camera`,
           then the expected range of values for `pixel_coords` is [-1., 1.]
           and the expected of range values for `render_range` is [-inf, 0.].
  
      Args:
          pixel_coords (torch.Tensor):
              Image coordinates to render,
              of shape :math:`(\text{batch_size}, \text{num_pixels}, 2)`.
          render_ranges (torch.Tensor):
              Depth ranges on which intersection get rendered,
              of shape :math:`(\text{batch_size}, \text{num_pixels}, 2)`.
          face_vertices_z (torch.Tensor):
              3D points values of the face vertices in camera coordinate,
              values in front of camera are expected to be negative,
              higher values being closer to the camera.
              of shape :math:`(\text{batch_size}, \text{num_faces}, 3)`.
          face_vertices_image (torch.Tensor):
              2D positions of the face vertices on image plane,
              of shape :math:`(\text{batch_size}, \text{num_faces}, 3, 2)`,
              Note that face vertices are projected on image plane (z=-1)
              to forms face_vertices_image.
          face_features (torch.Tensor or list of torch.Tensor):
              Features (per-vertex per-face) to be drawn,
              of shape :math:`(\text{batch_size}, \text{num_faces}, 3, \text{feature_dim})`,
              feature is the features dimension,
              for instance with vertex colors num_features=3 (R, G, B),
              and texture coordinates num_features=2 (X, Y),
              or a list of num_features,
              of shapes :math:`(\text{batch_size}, \text{num_faces}, 3, \text{feature_dim[i]})`.
          knum (int):
              Maximum number of faces that influence one pixel. Default: 300.
  
      Returns:
          (torch.Tensor or list of torch.Tensor, torch.LongTensor):
  
              - The rendered features, of shape
                :math:`(\text{batch_size}, \text{num_pixels}, \text{knum}, \text{feature_dim})`,
                if `face_features` is a list of torch.Tensor,
                then it returns a list of torch.Tensor, of shapes
                :math:`(\text{batch_size}, \text{num_pixels}, \text{knum}, \text{feature_dim[i]})`.
              - The rendered face index, -1 is void, of shape
                :math:`(\text{batch_size}, \text{num_pixels}, \text{knum})`.
  
      .. _Learning Deformable Tetrahedral Meshes for 3D Reconstruction:
              https://arxiv.org/abs/2011.01437
      """
      _face_features = torch.cat(
          face_features, dim=-1
      ) if isinstance(face_features, (list, tuple)) else face_features
  
      image_features, face_idx = DeftetSparseRenderer.apply(
          pixel_coords, render_ranges, face_vertices_z,
          face_vertices_image, _face_features, knum)
      if isinstance(face_features, (list, tuple)):
          _image_features = []
          cur_idx = 0
          for face_feature in face_features:
              _image_features.append(image_features[..., cur_idx:cur_idx + face_feature.shape[-1]])
              cur_idx += face_feature.shape[-1]
          image_features = tuple(_image_features)
      return image_features, face_idx
function_tokens: def deftet_sparse_render ( pixel_coords , render_ranges , face_vertices_z , face_vertices_image , face_features , knum = 300 ) : _face_features = torch . cat ( face_features , dim = - 1 ) if isinstance ( face_features , ( list , tuple ) ) else face_features image_features , face_idx = DeftetSparseRenderer . apply ( pixel_coords , render_ranges , face_vertices_z , face_vertices_image , _face_features , knum ) if isinstance ( face_features , ( list , tuple ) ) : _image_features = [ ] cur_idx = 0 for face_feature in face_features : _image_features . append ( image_features [ ... , cur_idx : cur_idx + face_feature . shape [ - 1 ] ] ) cur_idx += face_feature . shape [ - 1 ] image_features = tuple ( _image_features ) return image_features , face_idx