code: def test_align(self):
      N, V = 1, 2
      device = torch.device("cuda:0")
      voxels = torch.ones(
          (N, V, V, V), dtype=torch.float32, device=device
      )
  
      # topleft align
      mesh = cubify(voxels, 0.5)
      verts, faces = mesh.get_mesh_verts_faces(0)
      self.assertClose(verts.min(), torch.tensor(-1.0, device=device))
      self.assertClose(verts.max(), torch.tensor(3.0, device=device))
  
      # corner align
      mesh = cubify(voxels, 0.5, align="corner")
      verts, faces = mesh.get_mesh_verts_faces(0)
      self.assertClose(verts.min(), torch.tensor(-1.0, device=device))
      self.assertClose(verts.max(), torch.tensor(1.0, device=device))
  
      # center align
      mesh = cubify(voxels, 0.5, align="center")
      verts, faces = mesh.get_mesh_verts_faces(0)
      self.assertClose(verts.min(), torch.tensor(-2.0, device=device))
      self.assertClose(verts.max(), torch.tensor(2.0, device=device))
  
      # invalid align
      with self.assertRaisesRegex(
          ValueError, "Align mode must be one of"
      ):
          cubify(voxels, 0.5, align="")
  
      # invalid align
      with self.assertRaisesRegex(
          ValueError, "Align mode must be one of"
      ):
          cubify(voxels, 0.5, align="topright")
  
      # inside occupancy, similar to GH#185 use case
      N, V = 1, 4
      voxels = torch.zeros(
          (N, V, V, V), dtype=torch.float32, device=device
      )
      voxels[0, : V // 2, : V // 2, : V // 2] = 1.0
      mesh = cubify(voxels, 0.5, align="corner")
      verts, faces = mesh.get_mesh_verts_faces(0)
      self.assertClose(verts.min(), torch.tensor(-1.0, device=device))
      self.assertClose(verts.max(), torch.tensor(0.0, device=device))
  
file_path: pytorch3d/tests/test_cubify.py
imports: import unittest
  import torch
  from pytorch3d.ops import cubify
  from .common_testing import TestCaseMixin
label_desc: Use image node_id 3 for calling the TestCubify obj's underlying member method code with example usage: obj.test_align() without return types