π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
added cpu option for other tests
Carlos Be640717e167c
diff --git a/test/test_conversions.py b/test/test_conversions.pyindex 921b6ddaa..cb65300f0 100644--- a/test/test_conversions.py+++ b/test/test_conversions.py@@ -6,14 +6,13 @@ from torch.autograd import gradcheckimport utils # test utilsfrom utils import check_equal_torch, check_equal_numpy-from common import TEST_DEVICES+from common import device_typedef test_pi():assert pytest.approx(tgm.pi.item(), 3.141592)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_shape", [(2, 3), (1, 2, 3), (2, 3, 3), (5, 5, 3), ])def test_rad2deg(batch_shape, device_type):@@ -37,7 +36,6 @@ def test_rad2deg(batch_shape, device_type):raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_shape", [(2, 3), (1, 2, 3), (2, 3, 3), (5, 5, 3), ])def test_deg2rad(batch_shape, device_type):@@ -60,7 +58,6 @@ def test_deg2rad(batch_shape, device_type):raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_shape", [(2, 3), (1, 2, 3), (2, 3, 3), (5, 5, 3), ])def test_convert_points_to_homogeneous(batch_shape, device_type):@@ -83,7 +80,6 @@ def test_convert_points_to_homogeneous(batch_shape, device_type):raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_shape", [(2, 3), (1, 2, 3), (2, 3, 3), (5, 5, 3), ])def test_convert_points_from_homogeneous(batch_shape, device_type):@@ -107,7 +103,6 @@ def test_convert_points_from_homogeneous(batch_shape, device_type):raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 5])@pytest.mark.parametrize("num_points", [2, 3, 5])@pytest.mark.parametrize("num_dims", [2, 3])@@ -142,7 +137,6 @@ def test_transform_points(batch_size, num_points, num_dims, device_type):raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 5])def test_angle_axis_to_rotation_matrix(batch_size, device_type):# generate input data@@ -163,7 +157,6 @@ def test_angle_axis_to_rotation_matrix(batch_size, device_type):raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 5])def test_rtvec_to_pose_gradcheck(batch_size, device_type):# generate input data@@ -174,7 +167,6 @@ def test_rtvec_to_pose_gradcheck(batch_size, device_type):assert gradcheck(tgm.rtvec_to_pose, (rtvec,), raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 5])def test_rotation_matrix_to_angle_axis_gradcheck(batch_size, device_type):# generate input data@@ -186,7 +178,6 @@ def test_rotation_matrix_to_angle_axis_gradcheck(batch_size, device_type):(rmat,), raise_exception=True)[email protected]("device_type", TEST_DEVICES)def test_rotation_matrix_to_angle_axis(device_type):device = torch.device(device_type)rmat_1 = torch.tensor([[-0.30382753, -0.95095137, -0.05814062, 0.],diff --git a/test/test_homography_warper.py b/test/test_homography_warper.pyindex 0445eebea..b8fc9f457 100644--- a/test/test_homography_warper.py+++ b/test/test_homography_warper.py@@ -5,7 +5,7 @@ import torchgeometry as tgmfrom torch.autograd import gradcheckimport utils # test utils-from common import TEST_DEVICES+from common import device_typeclass TestHomographyWarper:@@ -112,7 +112,6 @@ class TestHomographyWarper:assert utils.check_equal_torch(patch_src[..., -1, -1], patch_dst[..., -1, 0])- @pytest.mark.parametrize("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 3])def test_homography_warper(self, batch_size, device_type):# generate input data@@ -156,7 +155,6 @@ class TestHomographyWarper:assert utils.check_equal_torch(patch_dst_to_src, patch_dst_to_src_functional)- @pytest.mark.parametrize("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_shape", [(1, 1, 7, 5), (2, 3, 8, 5), (1, 1, 7, 16), ])def test_gradcheck(self, batch_shape, device_type):diff --git a/test/test_image.py b/test/test_image.pyindex de7f2961d..5bda49848 100644--- a/test/test_image.py+++ b/test/test_image.py@@ -5,7 +5,7 @@ import torchgeometry.image as imagefrom torch.autograd import gradcheckimport utils-from common import TEST_DEVICES+from common import device_type@pytest.mark.parametrize("window_size", [5, 11])@@ -27,7 +27,6 @@ def test_get_gaussian_kernel2d(ksize_x, ksize_y, sigma):class TestGaussianBlur:- @pytest.mark.parametrize("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_shape",[(1, 4, 8, 15), (2, 3, 11, 7)])def test_gaussian_blur(self, batch_shape, device_type):diff --git a/test/test_imgwarp.py b/test/test_imgwarp.pyindex ef15bdf9a..e0ebe7278 100644--- a/test/test_imgwarp.py+++ b/test/test_imgwarp.py@@ -1,4 +1,3 @@-import unittestimport pytestimport torch@@ -6,10 +5,9 @@ import torchgeometry as tgmfrom torch.autograd import gradcheckimport utils # test utils-from common import TEST_DEVICES+from common import device_type[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_shape",[(1, 1, 7, 32), (2, 3, 16, 31)])def test_warp_perspective_rotation(batch_shape, device_type):@@ -50,7 +48,6 @@ def test_warp_perspective_rotation(batch_shape, device_type):raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 5])def test_get_perspective_transform(batch_size, device_type):# generate input data@@ -81,7 +78,6 @@ def test_get_perspective_transform(batch_size, device_type):(points_src, points_dst,), raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 5])def test_rotation_matrix2d(batch_size, device_type):# generate input data@@ -134,7 +130,6 @@ def test_rotation_matrix2d(batch_size, device_type):raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 5])@pytest.mark.parametrize("channels", [1, 5])def test_warp_perspective_crop(batch_size, device_type, channels):diff --git a/test/test_jit_tracing.py b/test/test_jit_tracing.pyindex 698e1741f..8b652d27c 100644--- a/test/test_jit_tracing.py+++ b/test/test_jit_tracing.py@@ -1,5 +1,5 @@import pytest-from common import TEST_DEVICES+from common import device_typeimport torchimport torchgeometry as tgm@@ -69,7 +69,6 @@ class LocalizationNetwork(nn.Module):# TODO(wizaron): need the double check what's going on here@pytest.mark.skip(reason="in PyTorch >= v1.0.0 it crashes.")[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("affine", [True, False])def test_jit_tracing(device_type, affine):net = LocalizationNetwork((4, 4), pretrained=False, affine=affine)diff --git a/test/test_pinhole.py b/test/test_pinhole.pyindex 3f7934e64..ed38de9df 100644--- a/test/test_pinhole.py+++ b/test/test_pinhole.py@@ -5,7 +5,7 @@ import torchgeometry as tgmfrom torch.autograd import gradcheckimport utils # test utilities-from common import TEST_DEVICES+from common import device_typeclass TestPinholeCamera:@@ -258,7 +258,6 @@ class TestPinholeCamera:pinhole_scale.width, pinhole.width * scale_val)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 5, 6])def test_scale_pinhole(batch_size, device_type):# generate input data@@ -277,7 +276,6 @@ def test_scale_pinhole(batch_size, device_type):raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 5, 6])def test_pinhole_matrix(batch_size, device_type):# generate input data@@ -310,7 +308,6 @@ def test_pinhole_matrix(batch_size, device_type):raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 5, 6])def test_inverse_pinhole_matrix(batch_size, device_type):# generate input data@@ -345,7 +342,6 @@ def test_inverse_pinhole_matrix(batch_size, device_type):raise_exception=True)[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_size", [1, 2, 5, 6])def test_homography_i_H_ref(batch_size, device_type):# generate input data