Get rid of duplicate test data directory initialization

Summary: Simplify finding the data directories in the tests.

Reviewed By: nikhilaravi

Differential Revision: D27634293

fbshipit-source-id: dc308a7c86c41e6fae56a2ab58187c9f0335b575
This commit is contained in:
Rong Rong (AI Infra)
2021-04-08 20:02:16 -07:00
committed by Facebook GitHub Bot
parent 1216b5765a
commit dd8343922e
3 changed files with 17 additions and 23 deletions

View File

@@ -9,6 +9,7 @@ from pytorch3d.ops.marching_cubes import marching_cubes_naive
USE_SCIKIT = False
DATA_DIR = get_tests_dir() / "data"
def convert_to_local(verts, volume_dim):
@@ -640,7 +641,6 @@ class TestMarchingCubes(TestCaseMixin, unittest.TestCase):
volume, isolevel=64, return_local_coords=False
)
DATA_DIR = get_tests_dir() / "data"
data_filename = "test_marching_cubes_data/sphere_level64.pickle"
filename = os.path.join(DATA_DIR, data_filename)
with open(filename, "rb") as file:
@@ -676,7 +676,6 @@ class TestMarchingCubes(TestCaseMixin, unittest.TestCase):
volume = volume.permute(0, 3, 2, 1) # (B, D, H, W)
verts, faces = marching_cubes_naive(volume, isolevel=0.001)
DATA_DIR = get_tests_dir() / "data"
data_filename = "test_marching_cubes_data/double_ellipsoid.pickle"
filename = os.path.join(DATA_DIR, data_filename)
with open(filename, "rb") as file: