mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2026-01-17 03:40:34 +08:00
Extract finding directories for test data
Summary: Make common functions for finding directories where test data is found, instead of lots of tests using their own `__file__` while trying to get ./tests/data and the tutorials data. Reviewed By: nikhilaravi Differential Revision: D27633701 fbshipit-source-id: 1467bb6018cea16eba3cab097d713116d51071e9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
24ee279005
commit
1216b5765a
@@ -2,10 +2,9 @@
|
||||
import os
|
||||
import pickle
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import torch
|
||||
from common_testing import TestCaseMixin
|
||||
from common_testing import TestCaseMixin, get_tests_dir
|
||||
from pytorch3d.ops.marching_cubes import marching_cubes_naive
|
||||
|
||||
|
||||
@@ -641,7 +640,7 @@ class TestMarchingCubes(TestCaseMixin, unittest.TestCase):
|
||||
volume, isolevel=64, return_local_coords=False
|
||||
)
|
||||
|
||||
DATA_DIR = Path(__file__).resolve().parent / "data"
|
||||
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:
|
||||
@@ -677,7 +676,7 @@ 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 = Path(__file__).resolve().parent / "data"
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user