move targets

Summary: Move testing targets from pytorch3d/tests/TARGETS to pytorch3d/TARGETS.

Reviewed By: shapovalov

Differential Revision: D36186940

fbshipit-source-id: a4c52c4d99351f885e2b0bf870532d530324039b
This commit is contained in:
Jeremy Reizenstein 2022-05-25 06:16:03 -07:00 committed by Facebook GitHub Bot
parent f625fe1f8b
commit 34f648ede0
121 changed files with 231 additions and 239 deletions

View File

@ -10,7 +10,7 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
DIR=$(dirname "${DIR}")
if [[ -f "${DIR}/tests/TARGETS" ]]
if [[ -f "${DIR}/TARGETS" ]]
then
pyfmt "${DIR}"
else
@ -30,7 +30,7 @@ clangformat=$(command -v clang-format-8 || echo clang-format)
find "${DIR}" -regex ".*\.\(cpp\|c\|cc\|cu\|cuh\|cxx\|h\|hh\|hpp\|hxx\|tcc\|mm\|m\)" -print0 | xargs -0 "${clangformat}" -i
# Run arc and pyre internally only.
if [[ -f "${DIR}/tests/TARGETS" ]]
if [[ -f "${DIR}/TARGETS" ]]
then
(cd "${DIR}"; command -v arc > /dev/null && arc lint) || true

View File

@ -51,7 +51,7 @@ def tests_from_file(path: Path, base: str) -> List[str]:
def main() -> None:
files = get_test_files()
test_root = Path(__file__).parent.parent / "tests"
test_root = Path(__file__).parent.parent
all_tests = []
for f in files:
file_base = str(f.relative_to(test_root))[:-3].replace("/", ".")

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.
from fvcore.common.benchmark import benchmark
from test_acos_linear_extrapolation import TestAcosLinearExtrapolation
from tests.test_acos_linear_extrapolation import TestAcosLinearExtrapolation
def bm_acos_linear_extrapolation() -> None:

View File

@ -7,7 +7,7 @@
from itertools import product
from fvcore.common.benchmark import benchmark
from test_ball_query import TestBallQuery
from tests.test_ball_query import TestBallQuery
def bm_ball_query() -> None:

View File

@ -8,7 +8,7 @@
from itertools import product
from fvcore.common.benchmark import benchmark
from test_blending import TestBlending
from tests.test_blending import TestBlending
def bm_blending() -> None:

View File

@ -7,7 +7,7 @@
import itertools
from fvcore.common.benchmark import benchmark
from test_cameras_alignment import TestCamerasAlignment
from tests.test_cameras_alignment import TestCamerasAlignment
def bm_cameras_alignment() -> None:

View File

@ -8,7 +8,7 @@ from itertools import product
import torch
from fvcore.common.benchmark import benchmark
from test_chamfer import TestChamfer
from tests.test_chamfer import TestChamfer
def bm_chamfer() -> None:

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.
from fvcore.common.benchmark import benchmark
from test_cubify import TestCubify
from tests.test_cubify import TestCubify
def bm_cubify() -> None:

View File

@ -9,7 +9,7 @@ from itertools import product
import torch
from fvcore.common.benchmark import benchmark
from test_face_areas_normals import TestFaceAreasNormals
from tests.test_face_areas_normals import TestFaceAreasNormals
def bm_face_areas_normals() -> None:

View File

@ -9,7 +9,7 @@ from itertools import product
import torch
from fvcore.common.benchmark import benchmark
from test_graph_conv import TestGraphConv
from tests.test_graph_conv import TestGraphConv
def bm_graph_conv() -> None:

View File

@ -7,7 +7,7 @@
from itertools import product
from fvcore.common.benchmark import benchmark
from test_iou_box3d import TestIoU3D
from tests.test_iou_box3d import TestIoU3D
def bm_iou_box3d() -> None:

View File

@ -7,7 +7,7 @@
from itertools import product
from fvcore.common.benchmark import benchmark
from test_knn import TestKNN
from tests.test_knn import TestKNN
def bm_knn() -> None:

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.
from fvcore.common.benchmark import benchmark
from test_marching_cubes import TestMarchingCubes
from tests.test_marching_cubes import TestMarchingCubes
def bm_marching_cubes() -> None:

View File

@ -8,7 +8,7 @@
from itertools import product
from fvcore.common.benchmark import benchmark
from test_mesh_edge_loss import TestMeshEdgeLoss
from tests.test_mesh_edge_loss import TestMeshEdgeLoss
def bm_mesh_edge_loss() -> None:

View File

@ -7,8 +7,8 @@
from itertools import product
from fvcore.common.benchmark import benchmark
from test_io_obj import TestMeshObjIO
from test_io_ply import TestMeshPlyIO
from tests.test_io_obj import TestMeshObjIO
from tests.test_io_ply import TestMeshPlyIO
def bm_save_load() -> None:

View File

@ -9,7 +9,7 @@ from itertools import product
import torch
from fvcore.common.benchmark import benchmark
from test_mesh_laplacian_smoothing import TestLaplacianSmoothing
from tests.test_mesh_laplacian_smoothing import TestLaplacianSmoothing
def bm_mesh_laplacian_smoothing() -> None:

View File

@ -9,7 +9,7 @@ from itertools import product
import torch
from fvcore.common.benchmark import benchmark
from test_mesh_normal_consistency import TestMeshNormalConsistency
from tests.test_mesh_normal_consistency import TestMeshNormalConsistency
def bm_mesh_normal_consistency() -> None:

View File

@ -9,7 +9,7 @@ from itertools import product
import torch
from fvcore.common.benchmark import benchmark
from test_meshes import TestMeshes
from tests.test_meshes import TestMeshes
def bm_compute_packed_padded_meshes() -> None:

View File

@ -9,7 +9,7 @@ from itertools import product
import torch
from fvcore.common.benchmark import benchmark
from test_packed_to_padded import TestPackedToPadded
from tests.test_packed_to_padded import TestPackedToPadded
def bm_packed_to_padded() -> None:

View File

@ -7,7 +7,7 @@
import itertools
from fvcore.common.benchmark import benchmark
from test_perspective_n_points import TestPerspectiveNPoints
from tests.test_perspective_n_points import TestPerspectiveNPoints
def bm_perspective_n_points() -> None:

View File

@ -8,7 +8,7 @@
from itertools import product
from fvcore.common.benchmark import benchmark
from test_point_mesh_distance import TestPointMeshDistance
from tests.test_point_mesh_distance import TestPointMeshDistance
def bm_point_mesh_distance() -> None:

View File

@ -8,7 +8,7 @@
from itertools import product
from fvcore.common.benchmark import benchmark
from test_pointclouds import TestPointclouds
from tests.test_pointclouds import TestPointclouds
def bm_compute_packed_padded_pointclouds() -> None:

View File

@ -8,7 +8,7 @@ from copy import deepcopy
from itertools import product
from fvcore.common.benchmark import benchmark
from test_points_alignment import TestCorrespondingPointsAlignment, TestICP
from tests.test_points_alignment import TestCorrespondingPointsAlignment, TestICP
def bm_iterative_closest_point() -> None:

View File

@ -9,7 +9,7 @@ import itertools
import torch
from fvcore.common.benchmark import benchmark
from pytorch3d.ops import estimate_pointcloud_normals
from test_points_normals import TestPCLNormals
from tests.test_points_normals import TestPCLNormals
def to_bm(num_points, use_symeig_workaround):

View File

@ -7,7 +7,7 @@
import itertools
from fvcore.common.benchmark import benchmark
from test_points_to_volumes import TestPointsToVolumes
from tests.test_points_to_volumes import TestPointsToVolumes
def bm_points_to_volumes() -> None:

View File

@ -9,7 +9,7 @@ from itertools import product
import torch
from fvcore.common.benchmark import benchmark
from test_rasterize_meshes import TestRasterizeMeshes
from tests.test_rasterize_meshes import TestRasterizeMeshes
# ico levels:

View File

@ -8,7 +8,7 @@ import itertools
from fvcore.common.benchmark import benchmark
from pytorch3d.renderer import AbsorptionOnlyRaymarcher, EmissionAbsorptionRaymarcher
from test_raymarching import TestRaymarching
from tests.test_raymarching import TestRaymarching
def bm_raymarching() -> None:

View File

@ -16,7 +16,7 @@ from pytorch3d.renderer import (
OrthographicCameras,
PerspectiveCameras,
)
from test_raysampling import TestRaysampling
from tests.test_raysampling import TestRaysampling
def bm_raysampling() -> None:

View File

@ -8,7 +8,7 @@ import itertools
from fvcore.common.benchmark import benchmark
from pytorch3d.renderer import AbsorptionOnlyRaymarcher, EmissionAbsorptionRaymarcher
from test_render_implicit import TestRenderImplicit
from tests.test_render_implicit import TestRenderImplicit
def bm_render_volumes() -> None:

View File

@ -8,7 +8,7 @@ import itertools
from fvcore.common.benchmark import benchmark
from pytorch3d.renderer import AbsorptionOnlyRaymarcher, EmissionAbsorptionRaymarcher
from test_render_volumes import TestRenderVolumes
from tests.test_render_volumes import TestRenderVolumes
def bm_render_volumes() -> None:

View File

@ -7,7 +7,7 @@
from itertools import product
from fvcore.common.benchmark import benchmark
from test_sample_farthest_points import TestFPS
from tests.test_sample_farthest_points import TestFPS
def bm_fps() -> None:

View File

@ -7,7 +7,7 @@
from itertools import product
from fvcore.common.benchmark import benchmark
from test_sample_pdf import TestSamplePDF
from tests.test_sample_pdf import TestSamplePDF
def bm_sample_pdf() -> None:

View File

@ -9,7 +9,7 @@ from itertools import product
import torch
from fvcore.common.benchmark import benchmark
from test_sample_points_from_meshes import TestSamplePoints
from tests.test_sample_points_from_meshes import TestSamplePoints
def bm_sample_points() -> None:

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.
from fvcore.common.benchmark import benchmark
from test_se3 import TestSE3
from tests.test_se3 import TestSE3
def bm_se3() -> None:

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.
from fvcore.common.benchmark import benchmark
from test_so3 import TestSO3
from tests.test_so3 import TestSO3
def bm_so3() -> None:

View File

@ -8,7 +8,7 @@
from itertools import product
from fvcore.common.benchmark import benchmark
from test_subdivide_meshes import TestSubdivideMeshes
from tests.test_subdivide_meshes import TestSubdivideMeshes
def bm_subdivide() -> None:

View File

@ -12,7 +12,7 @@ import torch
from common_testing import get_random_cuda_device
from fvcore.common.benchmark import benchmark
from pytorch3d.common.workaround import symeig3x3
from test_symeig3x3 import TestSymEig3x3
from tests.test_symeig3x3 import TestSymEig3x3
torch.set_num_threads(1)

View File

@ -9,7 +9,7 @@ from itertools import product
import torch
from fvcore.common.benchmark import benchmark
from test_vert_align import TestVertAlign
from tests.test_vert_align import TestVertAlign
def bm_vert_align() -> None:

View File

@ -38,7 +38,7 @@ def get_pytorch3d_dir() -> Path:
Meta internal systems need a special case here.
"""
if os.environ.get("INSIDE_RE_WORKER") is not None:
return Path(__file__).resolve().parent
return Path(__file__).resolve().parent.parent
elif os.environ.get("CONDA_BUILD_STATE", "") == "TEST":
return Path(os.environ["SRC_DIR"])
else:

View File

@ -5,16 +5,11 @@
# LICENSE file in the root directory of this source tree.
import importlib
import os
import sys
import unittest
import unittest.mock
if os.environ.get("FB_TEST", False):
from common_testing import get_pytorch3d_dir
else:
from tests.common_testing import get_pytorch3d_dir
from tests.common_testing import get_pytorch3d_dir
# This file groups together tests which look at the code without running it.

View File

@ -4,7 +4,6 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import unittest
from math import pi
@ -15,12 +14,7 @@ from pytorch3d.implicitron.tools.circle_fitting import (
fit_circle_in_3d,
)
from pytorch3d.transforms import random_rotation
if os.environ.get("FB_TEST", False):
from common_testing import TestCaseMixin
else:
from tests.common_testing import TestCaseMixin
from tests.common_testing import TestCaseMixin
class TestCircleFitting(TestCaseMixin, unittest.TestCase):

View File

@ -4,7 +4,6 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import unittest
from omegaconf import OmegaConf
@ -30,15 +29,9 @@ from pytorch3d.implicitron.tools.config import (
get_default_args,
remove_unused_components,
)
from tests.common_testing import get_tests_dir
if os.environ.get("FB_TEST", False):
from common_testing import get_tests_dir
from .common_resources import provide_resnet34
else:
from common_resources import provide_resnet34
from tests.common_testing import get_tests_dir
from .common_resources import provide_resnet34
DATA_DIR = get_tests_dir() / "implicitron/data"
DEBUG: bool = False

View File

@ -4,17 +4,12 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import unittest
from omegaconf import OmegaConf
from pytorch3d.implicitron.dataset.data_source import ImplicitronDataSource
from pytorch3d.implicitron.tools.config import get_default_args
if os.environ.get("FB_TEST", False):
from common_testing import get_tests_dir
else:
from tests.common_testing import get_tests_dir
from tests.common_testing import get_tests_dir
DATA_DIR = get_tests_dir() / "implicitron/data"
DEBUG: bool = False

View File

@ -21,15 +21,9 @@ from pytorch3d.vis.plotly_vis import plot_scene
if os.environ.get("INSIDE_RE_WORKER") is None:
from visdom import Visdom
if os.environ.get("FB_TEST", False):
from .common_resources import get_skateboard_data
else:
from common_resources import get_skateboard_data
from tests.common_testing import interactive_testing_requested
if os.environ.get("FB_TEST", False):
from common_testing import interactive_testing_requested
else:
from tests.common_testing import interactive_testing_requested
from .common_resources import get_skateboard_data
class TestDatasetVisualize(unittest.TestCase):

View File

@ -4,7 +4,6 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import unittest
import torch
@ -13,12 +12,7 @@ from pytorch3d.implicitron.tools.eval_video_trajectory import (
)
from pytorch3d.renderer.cameras import look_at_view_transform, PerspectiveCameras
from pytorch3d.transforms import axis_angle_to_matrix
if os.environ.get("FB_TEST", False):
from common_testing import TestCaseMixin
else:
from tests.common_testing import TestCaseMixin
from tests.common_testing import TestCaseMixin
class TestEvalCameras(TestCaseMixin, unittest.TestCase):

View File

@ -9,16 +9,9 @@ import unittest
from pytorch3d.implicitron import eval_demo
from tests.common_testing import interactive_testing_requested
if os.environ.get("FB_TEST", False):
from .common_resources import CO3D_MANIFOLD_PATH, get_path_manager
else:
from common_resources import CO3D_MANIFOLD_PATH, get_path_manager
if os.environ.get("FB_TEST", False):
from common_testing import interactive_testing_requested
else:
from tests.common_testing import interactive_testing_requested
from .common_resources import CO3D_MANIFOLD_PATH, get_path_manager
"""
This test runs a single sequence eval_demo, useful for debugging datasets.

View File

@ -13,16 +13,9 @@ from pytorch3d.implicitron.models.generic_model import GenericModel
from pytorch3d.implicitron.models.renderer.base import EvaluationMode
from pytorch3d.implicitron.tools.config import expand_args_fields, get_default_args
from pytorch3d.renderer.cameras import look_at_view_transform, PerspectiveCameras
from tests.common_testing import get_pytorch3d_dir
if os.environ.get("FB_TEST", False):
from .common_resources import provide_resnet34
else:
from common_resources import provide_resnet34
if os.environ.get("FB_TEST", False):
from common_testing import get_pytorch3d_dir
else:
from tests.common_testing import get_pytorch3d_dir
from .common_resources import provide_resnet34
IMPLICITRON_CONFIGS_DIR = (
get_pytorch3d_dir() / "projects" / "implicitron_trainer" / "configs"

View File

@ -4,18 +4,12 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import unittest
import torch
from pytorch3d.implicitron.models.renderer.ray_point_refiner import RayPointRefiner
from pytorch3d.renderer import RayBundle
if os.environ.get("FB_TEST", False):
from common_testing import TestCaseMixin
else:
from tests.common_testing import TestCaseMixin
from tests.common_testing import TestCaseMixin
class TestRayPointRefiner(TestCaseMixin, unittest.TestCase):

View File

@ -4,7 +4,6 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import unittest
import torch
@ -16,12 +15,7 @@ from pytorch3d.implicitron.models.implicit_function.scene_representation_network
from pytorch3d.implicitron.models.renderer.base import ImplicitFunctionWrapper
from pytorch3d.implicitron.tools.config import get_default_args
from pytorch3d.renderer import RayBundle
if os.environ.get("FB_TEST", False):
from common_testing import TestCaseMixin
else:
from tests.common_testing import TestCaseMixin
from tests.common_testing import TestCaseMixin
_BATCH_SIZE: int = 3
_N_RAYS: int = 100

View File

@ -12,12 +12,7 @@ from os import path
import torch
# fmt: off
# Make the mixin available.
sys.path.insert(0, path.join(path.dirname(__file__), ".."))
from common_testing import TestCaseMixin # isort:skip # noqa: E402
# fmt: on
from ..common_testing import TestCaseMixin
sys.path.insert(0, path.join(path.dirname(__file__), "..", ".."))

View File

@ -15,12 +15,7 @@ import imageio
import numpy as np
import torch
# fmt: off
# Make the mixin available.
sys.path.insert(0, path.join(path.dirname(__file__), ".."))
from common_testing import TestCaseMixin # isort:skip # noqa: E402
# fmt: on
from ..common_testing import TestCaseMixin
# Making sure you can run this, even if pulsar hasn't been installed yet.
sys.path.insert(0, path.join(path.dirname(__file__), "..", ".."))

View File

@ -12,12 +12,7 @@ from os import path
import torch
# fmt: off
# Make the mixin available.
sys.path.insert(0, path.join(path.dirname(__file__), ".."))
from common_testing import TestCaseMixin # isort:skip # noqa: E402
# fmt: on
from ..common_testing import TestCaseMixin
# Making sure you can run this, even if pulsar hasn't been installed yet.

View File

@ -9,10 +9,11 @@ import unittest
import numpy as np
import torch
from common_testing import TestCaseMixin
from pytorch3d.common.compat import lstsq
from pytorch3d.transforms import acos_linear_extrapolation
from .common_testing import TestCaseMixin
class TestAcosLinearExtrapolation(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -8,12 +8,13 @@ import unittest
from itertools import product
import torch
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import sample_points_from_meshes
from pytorch3d.ops.ball_query import ball_query
from pytorch3d.ops.knn import _KNN
from pytorch3d.utils import ico_sphere
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestBallQuery(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -7,7 +7,6 @@
import unittest
import torch
from common_testing import TestCaseMixin
from pytorch3d.renderer.blending import (
BlendParams,
hard_rgb_blend,
@ -18,6 +17,8 @@ from pytorch3d.renderer.cameras import FoVPerspectiveCameras
from pytorch3d.renderer.mesh.rasterizer import Fragments
from pytorch3d.renderer.splatter_blend import SplatterBlender
from .common_testing import TestCaseMixin
def sigmoid_blend_naive_loop(colors, fragments, blend_params):
"""

View File

@ -12,7 +12,7 @@ import unittest
import unittest.mock
from collections import Counter
from common_testing import get_pytorch3d_dir
from .common_testing import get_pytorch3d_dir
# This file groups together tests which look at the code without running it.

View File

@ -10,7 +10,6 @@ import unittest
import numpy as np
import torch
from common_testing import get_tests_dir, TestCaseMixin
from pytorch3d.ops import eyes
from pytorch3d.renderer.points.pulsar import Renderer as PulsarRenderer
from pytorch3d.transforms import so3_exp_map, so3_log_map
@ -20,6 +19,8 @@ from pytorch3d.utils import (
pulsar_from_opencv_projection,
)
from .common_testing import get_tests_dir, TestCaseMixin
DATA_DIR = get_tests_dir() / "data"

View File

@ -7,7 +7,6 @@
import unittest
import torch
from common_testing import TestCaseMixin
from pytorch3d.renderer import (
MeshRasterizer,
NDCMultinomialRaysampler,
@ -19,6 +18,8 @@ from pytorch3d.renderer import (
)
from pytorch3d.structures import Meshes, Pointclouds
from .common_testing import TestCaseMixin
"""
PyTorch3D renderers operate in an align_corners=False manner.

View File

@ -8,7 +8,6 @@ import unittest
from math import radians
import torch
from common_testing import TestCaseMixin
from pytorch3d.renderer.camera_utils import camera_to_eye_at_up, rotate_on_spot
from pytorch3d.renderer.cameras import (
get_world_to_view_transform,
@ -18,6 +17,8 @@ from pytorch3d.renderer.cameras import (
from pytorch3d.transforms import axis_angle_to_matrix
from torch.nn.functional import normalize
from .common_testing import TestCaseMixin
def _batched_dotprod(x: torch.Tensor, y: torch.Tensor):
"""

View File

@ -36,7 +36,6 @@ import unittest
import numpy as np
import torch
from common_testing import TestCaseMixin
from pytorch3d.renderer.camera_utils import join_cameras_as_batch
from pytorch3d.renderer.cameras import (
camera_position_from_spherical_angles,
@ -57,6 +56,8 @@ from pytorch3d.transforms import Transform3d
from pytorch3d.transforms.rotation_conversions import random_rotations
from pytorch3d.transforms.so3 import so3_exp_map
from .common_testing import TestCaseMixin
# Naive function adapted from SoftRasterizer for test purposes.
def perspective_project_naive(points, fov=60.0):

View File

@ -8,7 +8,6 @@ import unittest
import numpy as np
import torch
from common_testing import TestCaseMixin
from pytorch3d.ops import corresponding_cameras_alignment
from pytorch3d.renderer.cameras import (
OpenGLOrthographicCameras,
@ -18,7 +17,9 @@ from pytorch3d.renderer.cameras import (
)
from pytorch3d.transforms.rotation_conversions import random_rotations
from pytorch3d.transforms.so3 import so3_exp_map, so3_relative_angle
from test_cameras import init_random_cameras
from .common_testing import TestCaseMixin
from .test_cameras import init_random_cameras
class TestCamerasAlignment(TestCaseMixin, unittest.TestCase):

View File

@ -10,10 +10,11 @@ from collections import namedtuple
import numpy as np
import torch
import torch.nn.functional as F
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.loss import chamfer_distance
from pytorch3d.structures.pointclouds import Pointclouds
from .common_testing import get_random_cuda_device, TestCaseMixin
# Output of init_pointclouds
points_normals = namedtuple(

View File

@ -7,9 +7,10 @@
import unittest
import torch
from common_testing import TestCaseMixin
from pytorch3d.common.linear_with_repeat import LinearWithRepeat
from .common_testing import TestCaseMixin
class TestLinearWithRepeat(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -8,7 +8,8 @@ import unittest
import numpy as np
import torch
from common_testing import TestCaseMixin
from .common_testing import TestCaseMixin
class TestOpsUtils(TestCaseMixin, unittest.TestCase):

View File

@ -9,9 +9,10 @@ import unittest
import numpy as np
import torch
from common_testing import TestCaseMixin
from pytorch3d.common.workaround import _safe_det_3x3
from .common_testing import TestCaseMixin
class TestSafeDet3x3(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -7,13 +7,14 @@
import unittest
import torch
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.renderer.compositing import (
alpha_composite,
norm_weighted_sum,
weighted_sum,
)
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestAccumulatePoints(TestCaseMixin, unittest.TestCase):

View File

@ -7,9 +7,10 @@
import unittest
import torch
from common_testing import TestCaseMixin
from pytorch3d.ops import cubify
from .common_testing import TestCaseMixin
class TestCubify(TestCaseMixin, unittest.TestCase):
def test_allempty(self):

View File

@ -8,10 +8,11 @@
import unittest
import torch
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import mesh_face_areas_normals
from pytorch3d.structures.meshes import Meshes
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestFaceAreasNormals(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -8,12 +8,13 @@ import unittest
import torch
import torch.nn as nn
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d import _C
from pytorch3d.ops.graph_conv import gather_scatter, gather_scatter_python, GraphConv
from pytorch3d.structures.meshes import Meshes
from pytorch3d.utils import ico_sphere
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestGraphConv(TestCaseMixin, unittest.TestCase):
def test_undirected(self):

View File

@ -7,9 +7,10 @@
import unittest
import torch
from common_testing import TestCaseMixin
from pytorch3d.renderer.implicit import HarmonicEmbedding
from .common_testing import TestCaseMixin
class TestHarmonicEmbedding(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -7,7 +7,6 @@
import unittest
import torch
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops.interp_face_attrs import (
interpolate_face_attributes,
interpolate_face_attributes_python,
@ -16,6 +15,8 @@ from pytorch3d.renderer.mesh import TexturesVertex
from pytorch3d.renderer.mesh.rasterizer import Fragments
from pytorch3d.structures import Meshes
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestInterpolateFaceAttributes(TestCaseMixin, unittest.TestCase):
def _test_interp_face_attrs(self, interp_fun, device):

View File

@ -9,7 +9,6 @@ from math import radians
import numpy as np
import torch
from common_testing import get_pytorch3d_dir, get_tests_dir, TestCaseMixin
from PIL import Image
from pytorch3d.io import IO
from pytorch3d.io.experimental_gltf_io import MeshGlbFormat
@ -32,6 +31,8 @@ from pytorch3d.structures import Meshes
from pytorch3d.transforms import axis_angle_to_matrix
from pytorch3d.vis.texture_vis import texturesuv_image_PIL
from .common_testing import get_pytorch3d_dir, get_tests_dir, TestCaseMixin
DATA_DIR = get_tests_dir() / "data"
TUTORIAL_DATA_DIR = get_pytorch3d_dir() / "docs/tutorials/data"

View File

@ -13,12 +13,6 @@ from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryDirectory
import torch
from common_testing import (
get_pytorch3d_dir,
get_tests_dir,
load_rgb_image,
TestCaseMixin,
)
from iopath.common.file_io import PathManager
from pytorch3d.io import IO, load_obj, load_objs_as_meshes, save_obj
from pytorch3d.io.mtl_io import (
@ -30,6 +24,13 @@ from pytorch3d.renderer import TexturesAtlas, TexturesUV, TexturesVertex
from pytorch3d.structures import join_meshes_as_batch, Meshes
from pytorch3d.utils import torus
from .common_testing import (
get_pytorch3d_dir,
get_tests_dir,
load_rgb_image,
TestCaseMixin,
)
DATA_DIR = get_tests_dir() / "data"
TUTORIAL_DATA_DIR = get_pytorch3d_dir() / "docs/tutorials/data"

View File

@ -8,11 +8,12 @@ import unittest
from tempfile import NamedTemporaryFile
import torch
from common_testing import TestCaseMixin
from pytorch3d.io import IO
from pytorch3d.renderer import TexturesAtlas, TexturesVertex
from pytorch3d.utils import ico_sphere
from .common_testing import TestCaseMixin
CUBE_FACES = [
[0, 1, 2],

View File

@ -13,7 +13,6 @@ from tempfile import NamedTemporaryFile, TemporaryFile
import numpy as np
import pytorch3d.io.ply_io
import torch
from common_testing import TestCaseMixin
from iopath.common.file_io import PathManager
from pytorch3d.io import IO
from pytorch3d.io.ply_io import load_ply, save_ply
@ -21,6 +20,8 @@ from pytorch3d.renderer.mesh import TexturesVertex
from pytorch3d.structures import Meshes, Pointclouds
from pytorch3d.utils import torus
from .common_testing import TestCaseMixin
global_path_manager = PathManager()

View File

@ -11,11 +11,12 @@ from typing import List, Tuple, Union
import torch
import torch.nn.functional as F
from common_testing import get_random_cuda_device, get_tests_dir, TestCaseMixin
from pytorch3d.io import save_obj
from pytorch3d.ops.iou_box3d import _box_planes, _box_triangles, box3d_overlap
from pytorch3d.transforms.rotation_conversions import random_rotation
from .common_testing import get_random_cuda_device, get_tests_dir, TestCaseMixin
OBJECTRON_TO_PYTORCH3D_FACE_IDX = [0, 4, 6, 2, 1, 5, 7, 3]
DATA_DIR = get_tests_dir() / "data"

View File

@ -8,9 +8,10 @@ import unittest
from itertools import product
import torch
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops.knn import _KNN, knn_gather, knn_points
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestKNN(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -7,10 +7,11 @@
import unittest
import torch
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import cot_laplacian, laplacian, norm_laplacian
from pytorch3d.structures.meshes import Meshes
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestLaplacianMatrices(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -8,10 +8,11 @@ import unittest
import numpy as np
import torch
from common_testing import TestCaseMixin
from pytorch3d.renderer.lighting import AmbientLights, DirectionalLights, PointLights
from pytorch3d.transforms import RotateAxisAngle
from .common_testing import TestCaseMixin
class TestLights(TestCaseMixin, unittest.TestCase):
def test_init_lights(self):

View File

@ -9,9 +9,10 @@ import pickle
import unittest
import torch
from common_testing import get_tests_dir, TestCaseMixin
from pytorch3d.ops.marching_cubes import marching_cubes_naive
from .common_testing import get_tests_dir, TestCaseMixin
USE_SCIKIT = False
DATA_DIR = get_tests_dir() / "data"

View File

@ -7,9 +7,10 @@
import unittest
import torch
from common_testing import TestCaseMixin
from pytorch3d.renderer.materials import Materials
from .common_testing import TestCaseMixin
class TestMaterials(TestCaseMixin, unittest.TestCase):
def test_init(self):

View File

@ -7,10 +7,11 @@
import unittest
import torch
from common_testing import TestCaseMixin
from pytorch3d.loss import mesh_edge_loss
from pytorch3d.structures import Meshes
from test_sample_points_from_meshes import init_meshes
from .common_testing import TestCaseMixin
from .test_sample_points_from_meshes import init_meshes
class TestMeshEdgeLoss(TestCaseMixin, unittest.TestCase):

View File

@ -8,11 +8,12 @@
import unittest
import torch
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import taubin_smoothing
from pytorch3d.structures import Meshes
from pytorch3d.utils import ico_sphere
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestTaubinSmoothing(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -10,9 +10,10 @@ import unittest
import numpy as np
import torch
from common_testing import TestCaseMixin
from pytorch3d.structures.meshes import Meshes
from .common_testing import TestCaseMixin
def init_mesh(
num_meshes: int = 10,

View File

@ -8,9 +8,10 @@ import unittest
import numpy as np
import torch
from common_testing import TestCaseMixin
from pytorch3d.ops import utils as oputil
from .common_testing import TestCaseMixin
class TestOpsUtils(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -7,10 +7,11 @@
import unittest
import torch
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import packed_to_padded, padded_to_packed
from pytorch3d.structures.meshes import Meshes
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestPackedToPadded(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -7,10 +7,11 @@
import unittest
import torch
from common_testing import TestCaseMixin
from pytorch3d.ops import perspective_n_points
from pytorch3d.transforms import rotation_conversions
from .common_testing import TestCaseMixin
def reproj_error(x_world, y, R, T, weight=None):
# applies the affine transform, projects, and computes the reprojection error

View File

@ -8,11 +8,12 @@ import unittest
import numpy as np
import torch
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d import _C
from pytorch3d.loss import point_mesh_edge_distance, point_mesh_face_distance
from pytorch3d.structures import Meshes, packed_to_list, Pointclouds
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestPointMeshDistance(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -10,10 +10,11 @@ import unittest
import numpy as np
import torch
from common_testing import TestCaseMixin
from pytorch3d.structures import utils as struct_utils
from pytorch3d.structures.pointclouds import join_pointclouds_as_batch, Pointclouds
from .common_testing import TestCaseMixin
class TestPointclouds(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -8,11 +8,12 @@ import unittest
import numpy as np
import torch
from common_testing import get_tests_dir, TestCaseMixin
from pytorch3d.ops import points_alignment
from pytorch3d.structures.pointclouds import Pointclouds
from pytorch3d.transforms import rotation_conversions
from .common_testing import get_tests_dir, TestCaseMixin
def _apply_pcl_transformation(X, R, T, s=None):
"""

View File

@ -8,13 +8,14 @@ import unittest
from typing import Tuple, Union
import torch
from common_testing import TestCaseMixin
from pytorch3d.ops import (
estimate_pointcloud_local_coord_frames,
estimate_pointcloud_normals,
)
from pytorch3d.structures.pointclouds import Pointclouds
from .common_testing import TestCaseMixin
DEBUG = False

View File

@ -11,7 +11,6 @@ from typing import Tuple
import numpy as np
import torch
from common_testing import TestCaseMixin
from pytorch3d.ops import (
add_pointclouds_to_volumes,
add_points_features_to_volume_densities_features,
@ -23,6 +22,8 @@ from pytorch3d.structures.pointclouds import Pointclouds
from pytorch3d.structures.volumes import Volumes
from pytorch3d.transforms.so3 import so3_exp_map
from .common_testing import TestCaseMixin
DEBUG = False
if DEBUG:

View File

@ -13,7 +13,6 @@ import unittest
import numpy as np
import torch
from common_testing import get_tests_dir, load_rgb_image, TestCaseMixin
from PIL import Image
from pytorch3d.datasets import (
BlenderCamera,
@ -32,6 +31,8 @@ from pytorch3d.transforms import Transform3d
from pytorch3d.transforms.so3 import so3_exp_map
from torch.utils.data import DataLoader
from .common_testing import get_tests_dir, load_rgb_image, TestCaseMixin
# Set these paths in order to run the tests.
R2N2_PATH = None

View File

@ -8,7 +8,6 @@ import functools
import unittest
import torch
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d import _C
from pytorch3d.renderer import FoVPerspectiveCameras, look_at_view_transform
from pytorch3d.renderer.mesh import MeshRasterizer, RasterizationSettings
@ -23,6 +22,8 @@ from pytorch3d.renderer.mesh.utils import (
from pytorch3d.structures import Meshes
from pytorch3d.utils import ico_sphere
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestRasterizeMeshes(TestCaseMixin, unittest.TestCase):
def test_simple_python(self):

View File

@ -9,7 +9,6 @@ import unittest
import numpy as np
import torch
from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d import _C
from pytorch3d.renderer.points.rasterize_points import (
_format_radius,
@ -18,6 +17,8 @@ from pytorch3d.renderer.points.rasterize_points import (
)
from pytorch3d.structures.pointclouds import Pointclouds
from .common_testing import get_random_cuda_device, TestCaseMixin
class TestRasterizePoints(TestCaseMixin, unittest.TestCase):
def test_python_simple_cpu(self):

View File

@ -9,12 +9,6 @@ from itertools import product
import numpy as np
import torch
from common_testing import (
get_pytorch3d_dir,
get_tests_dir,
load_rgb_image,
TestCaseMixin,
)
from PIL import Image
from pytorch3d.io import load_obj
from pytorch3d.renderer.cameras import FoVPerspectiveCameras, look_at_view_transform
@ -48,6 +42,13 @@ from pytorch3d.structures import Meshes, Pointclouds
from pytorch3d.transforms.transform3d import Transform3d
from pytorch3d.utils import torus
from .common_testing import (
get_pytorch3d_dir,
get_tests_dir,
load_rgb_image,
TestCaseMixin,
)
DEBUG = False
DATA_DIR = get_tests_dir() / "data"

View File

@ -9,7 +9,6 @@ import unittest
import numpy as np
import torch
from common_testing import get_tests_dir
from PIL import Image
from pytorch3d.renderer.cameras import FoVPerspectiveCameras, look_at_view_transform
from pytorch3d.renderer.mesh.rasterizer import MeshRasterizer, RasterizationSettings
@ -20,6 +19,8 @@ from pytorch3d.renderer.points.rasterizer import (
from pytorch3d.structures import Pointclouds
from pytorch3d.utils.ico_sphere import ico_sphere
from .common_testing import get_tests_dir
DATA_DIR = get_tests_dir() / "data"
DEBUG = False # Set DEBUG to true to save outputs from the tests.

View File

@ -7,9 +7,10 @@
import unittest
import torch
from common_testing import TestCaseMixin
from pytorch3d.renderer import AbsorptionOnlyRaymarcher, EmissionAbsorptionRaymarcher
from .common_testing import TestCaseMixin
class TestRaymarching(TestCaseMixin, unittest.TestCase):
def setUp(self) -> None:

View File

@ -8,7 +8,6 @@ import unittest
from typing import Callable
import torch
from common_testing import TestCaseMixin
from pytorch3d.common.compat import meshgrid_ij
from pytorch3d.ops import eyes
from pytorch3d.renderer import (
@ -32,7 +31,9 @@ from pytorch3d.renderer.implicit.utils import (
ray_bundle_variables_to_ray_points,
)
from pytorch3d.transforms import Rotate
from test_cameras import init_random_cameras
from .common_testing import TestCaseMixin
from .test_cameras import init_random_cameras
class TestNDCRaysamplerConvention(TestCaseMixin, unittest.TestCase):

View File

@ -8,7 +8,6 @@ import unittest
import numpy as np
import torch
from common_testing import TestCaseMixin
from pytorch3d.renderer import (
BlendParams,
EmissionAbsorptionRaymarcher,
@ -28,7 +27,9 @@ from pytorch3d.renderer import (
)
from pytorch3d.structures import Meshes
from pytorch3d.utils import ico_sphere
from test_render_volumes import init_cameras
from .common_testing import TestCaseMixin
from .test_render_volumes import init_cameras
DEBUG = False

Some files were not shown because too many files have changed in this diff Show More