code: def test_cube(self):
      volume_data = torch.zeros(1, 5, 5, 5)  # (B, W, H, D)
      volume_data[0, 1, 1, 1] = 1
      volume_data[0, 1, 1, 2] = 1
      volume_data[0, 2, 1, 1] = 1
      volume_data[0, 2, 1, 2] = 1
      volume_data[0, 1, 2, 1] = 1
      volume_data[0, 1, 2, 2] = 1
      volume_data[0, 2, 2, 1] = 1
      volume_data[0, 2, 2, 2] = 1
      volume_data = volume_data.permute(0, 3, 2, 1)  # (B, D, H, W)
      expected_verts = torch.tensor(
          [
              [1.0000, 0.9000, 1.0000],
              [1.0000, 1.0000, 0.9000],
              [0.9000, 1.0000, 1.0000],
              [2.0000, 0.9000, 1.0000],
              [2.0000, 1.0000, 0.9000],
              [2.1000, 1.0000, 1.0000],
              [1.0000, 2.0000, 0.9000],
              [0.9000, 2.0000, 1.0000],
              [2.0000, 2.0000, 0.9000],
              [2.1000, 2.0000, 1.0000],
              [1.0000, 2.1000, 1.0000],
              [2.0000, 2.1000, 1.0000],
              [1.0000, 0.9000, 2.0000],
              [0.9000, 1.0000, 2.0000],
              [2.0000, 0.9000, 2.0000],
              [2.1000, 1.0000, 2.0000],
              [0.9000, 2.0000, 2.0000],
              [2.1000, 2.0000, 2.0000],
              [1.0000, 2.1000, 2.0000],
              [2.0000, 2.1000, 2.0000],
              [1.0000, 1.0000, 2.1000],
              [2.0000, 1.0000, 2.1000],
              [1.0000, 2.0000, 2.1000],
              [2.0000, 2.0000, 2.1000],
          ]
      )
  
      expected_faces = torch.tensor(
          [
              [0, 1, 2],
              [0, 3, 4],
              [1, 0, 4],
              [4, 3, 5],
              [1, 6, 7],
              [2, 1, 7],
              [4, 8, 1],
              [1, 8, 6],
              [8, 4, 5],
              [9, 8, 5],
              [6, 10, 7],
              [6, 8, 11],
              [10, 6, 11],
              [8, 9, 11],
              [12, 0, 2],
              [13, 12, 2],
              [3, 0, 14],
              [14, 0, 12],
              [15, 5, 3],
              [14, 15, 3],
              [2, 7, 13],
              [7, 16, 13],
              [5, 15, 9],
              [9, 15, 17],
              [10, 18, 16],
              [7, 10, 16],
              [11, 19, 10],
              [19, 18, 10],
              [9, 17, 19],
              [11, 9, 19],
              [12, 13, 20],
              [14, 12, 20],
              [21, 14, 20],
              [15, 14, 21],
              [13, 16, 22],
              [20, 13, 22],
              [21, 20, 23],
              [20, 22, 23],
              [17, 15, 21],
              [23, 17, 21],
              [16, 18, 22],
              [23, 22, 18],
              [19, 23, 18],
              [17, 23, 19],
          ]
      )
      verts, faces = marching_cubes_naive(
          volume_data, 0.9, return_local_coords=False
      )
      self.assertClose(verts[0], expected_verts)
      self.assertClose(faces[0], expected_faces)
  
      verts, faces = marching_cubes(
          volume_data, 0.9, return_local_coords=False
      )
      verts2, faces2 = marching_cubes(
          volume_data, 0.9, return_local_coords=False
      )
  
      self.assertClose(verts[0], expected_verts)
      self.assertClose(faces[0], expected_faces)
  
      verts, faces = marching_cubes_naive(
          volume_data, 0.9, return_local_coords=True
      )
      expected_verts = convert_to_local(expected_verts, 5)
      self.assertClose(verts[0], expected_verts)
      self.assertClose(faces[0], expected_faces)
  
      # Check all values are in the range [-1, 1]
      self.assertTrue(verts[0].ge(-1).all() and verts[0].le(1).all())
  
      verts, faces = marching_cubes(
          volume_data, 0.9, return_local_coords=True
      )
      self.assertClose(verts[0], expected_verts)
      self.assertClose(faces[0], expected_faces)
      self.assertTrue(verts[0].ge(-1).all() and verts[0].le(1).all())
  
imports: import os
  import pickle
  import unittest
  import torch
  from pytorch3d.ops.marching_cubes import marching_cubes, marching_cubes_naive
  from .common_testing import get_tests_dir, TestCaseMixin
label_desc: Use image node_id 2 for calling the TestMarchingCubes obj's underlying member method code with example usage: obj.test_cube() without return types