π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Added first tests checking cpu / gpu
Carlos Bf464e18ec60e
diff --git a/conftest.py b/conftest.pynew file mode 100644index 000000000..bd0e0ad29--- /dev/null+++ b/conftest.py@@ -0,0 +1,5 @@+import pytest+++def pytest_addoption(parser):+ parser.addoption('--typetest', action="store", default="cpu")diff --git a/test/common.py b/test/common.pyindex 1ed369413..0051a8848 100644--- a/test/common.py+++ b/test/common.py@@ -1,4 +1,5 @@import torch+import pytestdef get_test_devices():@@ -17,3 +18,9 @@ def get_test_devices():# setup the devices to test the source codeTEST_DEVICES = get_test_devices()+++def device_type(request):+ typ = request.config.getoption('--typetest')+ return typdiff --git a/test/test_losses.py b/test/test_losses.pyindex f4decd958..23ae5cf88 100644--- a/test/test_losses.py+++ b/test/test_losses.py@@ -5,7 +5,7 @@ import torchgeometry as tgmfrom torch.autograd import gradcheckimport utils-from common import TEST_DEVICES+from common import device_typeclass TestFocalLoss:@@ -200,7 +200,6 @@ class TestDepthSmoothnessLoss:assert gradcheck(tgm.losses.depth_smoothness_loss,(depth, image,), raise_exception=True)- @pytest.mark.parametrize("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_shape",[(1, 1, 10, 16), (2, 4, 8, 15), ])def test_run_all(self, batch_shape, device_type):@@ -213,7 +212,6 @@ class TestDepthSmoothnessLoss:@pytest.mark.parametrize("window_size", [5, 11])@pytest.mark.parametrize("reduction_type", ['none', 'mean', 'sum'])[email protected]("device_type", TEST_DEVICES)@pytest.mark.parametrize("batch_shape",[(1, 1, 10, 16), (2, 4, 8, 15), ])def test_ssim(batch_shape, device_type, window_size, reduction_type):