code: def voxelize(voxel_coords, P, V):  # pragma: no cover
      """
      Copied from meshrcnn codebase:
      https://github.com/facebookresearch/meshrcnn/blob/main/tools/preprocess_shapenet.py#L284
      but changing flip y to flip x.
  
      Creating voxels of shape (D, D, D) from voxel_coords and projection matrix.
  
      Args:
          voxel_coords: FloatTensor of shape (V, 3) giving voxel's coordinates aligned to
              the vertices.
          P: FloatTensor of shape (4, 4) giving the projection matrix.
          V: Voxel size of the output.
  
      Returns:
          voxels: Tensor of shape (D, D, D) giving the voxelized result.
      """
      device = voxel_coords.device
      voxel_coords = project_verts(voxel_coords, P)
  
      # Using the actual zmin and zmax of the model is bad because we need them
      # to perform the inverse transform, which transform voxels back into world
      # space for refinement or evaluation. Instead we use an empirical min and
      # max over the dataset; that way it is consistent for all images.
      zmin = SHAPENET_MIN_ZMIN
      zmax = SHAPENET_MAX_ZMAX
  
      # Once we know zmin and zmax, we need to adjust the z coordinates so the
      # range [zmin, zmax] instead runs from [-1, 1]
      m = 2.0 / (zmax - zmin)
      b = -2.0 * zmin / (zmax - zmin) - 1
      voxel_coords[:, 2].mul_(m).add_(b)
      voxel_coords[:, 0].mul_(-1)  # Flip x
  
      # Now voxels are in [-1, 1]^3; map to [0, V-1)^3
      voxel_coords = 0.5 * (V - 1) * (voxel_coords + 1.0)
      voxel_coords = voxel_coords.round().to(torch.int64)
      valid = (0 <= voxel_coords) * (voxel_coords < V)
      valid = valid[:, 0] * valid[:, 1] * valid[:, 2]
      x, y, z = voxel_coords.unbind(dim=1)
      x, y, z = x[valid], y[valid], z[valid]
      voxels = torch.zeros(V, V, V, dtype=torch.uint8, device=device)
      voxels[z, y, x] = 1
  
      return voxels
  
imports: import math
  from typing import Dict, List
  import numpy
  import torch
  from pytorch3d.common.datatypes import Device
  from pytorch3d.datasets.utils import collate_batched_meshes
  from pytorch3d.ops import cubify
  from pytorch3d.renderer import HardPhongShader, MeshRasterizer, MeshRenderer, PointLights, RasterizationSettings, TexturesVertex
  from pytorch3d.renderer.cameras import CamerasBase
  from pytorch3d.transforms import Transform3d
label_desc: Use image node_id 7 for calling a global function with example usage: voxelize(voxel_coords, P, V) and returns: voxels