Commit 34f648ed authored by Jeremy Reizenstein's avatar Jeremy Reizenstein Committed by Facebook GitHub Bot
Browse files

move targets

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

Reviewed By: shapovalov

Differential Revision: D36186940

fbshipit-source-id: a4c52c4d99351f885e2b0bf870532d530324039b
parent f625fe1f
......@@ -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):
......
......@@ -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
......
......@@ -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
......
......@@ -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
if os.environ.get("FB_TEST", False):
from common_testing import interactive_testing_requested
else:
from tests.common_testing import interactive_testing_requested
from tests.common_testing import interactive_testing_requested
from .common_resources import get_skateboard_data
class TestDatasetVisualize(unittest.TestCase):
......
......@@ -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):
......
......@@ -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.
......
......@@ -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"
......
......@@ -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):
......
......@@ -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
......
......@@ -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__), "..", ".."))
......
......@@ -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__), "..", ".."))
......
......@@ -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.
......
......@@ -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:
......
......@@ -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:
......
......@@ -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):
"""
......
......@@ -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.
......
......@@ -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"
......
......@@ -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.
......
......@@ -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):
"""
......
......@@ -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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment