Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

[Feat] Improv conftest fixtures and remove device, dtype imports (#568)

Edgar Riba916a90e5acf6
diff --git a/Makefile b/Makefile
index 76e1937e1..7a21ad601 100644
--- a/Makefile
+++ b/Makefile
@@ -3,13 +3,13 @@
test: mypy lint build-docs test-all
test-all: FORCE
- pytest -v --device cpu,cuda --dtype float16,float32,float64 --cov=kornia test/ --flake8 --mypy
+ pytest -v --device all --dtype all --cov=kornia test/ --flake8 --mypy
test-cpu: FORCE
- pytest -v --device cpu --dtype float32,float64 --cov=kornia test/ --flake8 --mypy
+ pytest -v --device cpu --dtype all --cov=kornia test/ --flake8 --mypy
test-cuda: FORCE
- pytest -v --device cuda --dtype float16,float32,float64 --cov=kornia test/ --flake8 --mypy
+ pytest -v --device cuda --dtype all --cov=kornia test/ --flake8 --mypy
lint: FORCE
pytest -v --flake8 -m flake8
diff --git a/conftest.py b/conftest.py
index 77b844a8e..fbb7b5050 100644
--- a/conftest.py
+++ b/conftest.py
@@ -1,13 +1,82 @@
+from itertools import product
+from typing import Dict
+
import pytest
+import torch
+
+
+def get_test_devices() -> Dict[str, torch.device]:
+ """Creates a dictionary with the devices to test the source code.
+ CUDA devices will be test only in case the current hardware supports it.
+
+ Return:
+ dict(str, torch.device): list with devices names.
+ """
+ devices: Dict[str, torch.device] = {}
+ devices["cpu"] = torch.device("cpu")
+ if torch.cuda.is_available():
+ devices["cuda"] = torch.device("cuda:0")
+ return devices
+
+
+def get_test_dtypes() -> Dict[str, torch.dtype]:
+ """Creates a dictionary with the dtypes the source code.
+
+ Return:
+ dict(str, torch.dtype): list with dtype names.
+ """
+ dtypes: Dict[str, torch.dtype] = {}
+ dtypes["float16"] = torch.float16
+ dtypes["float32"] = torch.float32
+ dtypes["float64"] = torch.float64
+ return dtypes
+
+
+# setup the devices to test the source code
+
+TEST_DEVICES: Dict[str, torch.device] = get_test_devices()
+TEST_DTYPES: Dict[str, torch.dtype] = get_test_dtypes()
+
+# Combinations of device and dtype to be excluded from testing.
+DEVICE_DTYPE_BLACKLIST = {('cpu', 'float16')}
+
+
+def device(device_name) -> torch.device:
+ if device_name not in TEST_DEVICES:
+ pytest.skip(f"Unsupported device type: {device_name}")
+ return TEST_DEVICES[device_name]
+
+
+def dtype(dtype_name) -> torch.dtype:
+ return TEST_DTYPES[dtype_name]
def pytest_generate_tests(metafunc):
+ device_names = None
+ dtype_names = None
if 'device_name' in metafunc.fixturenames:
raw_value = metafunc.config.getoption('--device')
- metafunc.parametrize('device_name', raw_value.split(','))
+ if raw_value == 'all':
+ device_names = list(TEST_DEVICES.keys())
+ else:
+ device_names = raw_value.split(',')
if 'dtype_name' in metafunc.fixturenames:
raw_value = metafunc.config.getoption('--dtype')
- metafunc.parametrize('dtype_name', raw_value.split(','))
+ if raw_value == 'all':
+ dtype_names = list(TEST_DTYPES.keys())
+ else:
+ dtype_names = raw_value.split(',')
+ if device_names is not None and dtype_names is not None:
+ # Exclude any blacklisted device/dtype combinations.
+ params = [combo for combo in product(device_names, dtype_names)
+ if combo not in DEVICE_DTYPE_BLACKLIST]
+ metafunc.parametrize('device_name,dtype_name', params)
+ elif device_names is not None:
+ metafunc.parametrize('device_name', device_names)
+ elif dtype_names is not None:
+ metafunc.parametrize('dtype_name', dtype_names)
def pytest_addoption(parser):
diff --git a/test/augmentation/test_augmentation.py b/test/augmentation/test_augmentation.py
index 0c90e4668..dfc730884 100644
--- a/test/augmentation/test_augmentation.py
+++ b/test/augmentation/test_augmentation.py
@@ -13,8 +13,6 @@ from kornia.constants import pi
from kornia.augmentation import RandomHorizontalFlip, RandomVerticalFlip, ColorJitter, \
RandomErasing, RandomGrayscale, RandomRotation, RandomCrop, RandomResizedCrop, RandomMotionBlur
-from test.common import device
-
class TestRandomHorizontalFlip:
diff --git a/test/augmentation/test_functional.py b/test/augmentation/test_functional.py
index 8a4db3c5c..f973fb359 100644
--- a/test/augmentation/test_functional.py
+++ b/test/augmentation/test_functional.py
@@ -11,8 +11,6 @@ import kornia.augmentation.functional as F
from kornia.constants import pi
from kornia.augmentation import ColorJitter
-from test.common import device
-
class TestHorizontalFlipFn:
diff --git a/test/augmentation/test_perspective.py b/test/augmentation/test_perspective.py
index 4e39b84f0..57c83018d 100644
--- a/test/augmentation/test_perspective.py
+++ b/test/augmentation/test_perspective.py
@@ -7,7 +7,6 @@ from torch.autograd import gradcheck
import kornia
import kornia.augmentation.functional as F
import kornia.testing as utils # test utils
-from test.common import device
class TestPerspective:
diff --git a/test/augmentation/test_transformation_matrix.py b/test/augmentation/test_transformation_matrix.py
index f2d7f60f4..6cd98714f 100644
--- a/test/augmentation/test_transformation_matrix.py
+++ b/test/augmentation/test_transformation_matrix.py
@@ -11,8 +11,6 @@ import kornia.augmentation.functional as F
from kornia.constants import pi
from kornia.augmentation import ColorJitter
-from test.common import device
-
class TestHorizontalFlipFn:
diff --git a/test/color/test_adjust.py b/test/color/test_adjust.py
index c4cdba843..40472f7e5 100644
--- a/test/color/test_adjust.py
+++ b/test/color/test_adjust.py
@@ -3,7 +3,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
from kornia.constants import pi
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/color/test_core.py b/test/color/test_core.py
index 33d626b96..595013a3d 100644
--- a/test/color/test_core.py
+++ b/test/color/test_core.py
@@ -3,7 +3,6 @@ import random
import kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/color/test_gray.py b/test/color/test_gray.py
index 6bb1d6be2..b0d679a4a 100644
--- a/test/color/test_gray.py
+++ b/test/color/test_gray.py
@@ -2,7 +2,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
-from test.common import device, dtype
import torch
from torch.autograd import gradcheck
diff --git a/test/color/test_histogram.py b/test/color/test_histogram.py
index b2e1d49a1..57317a92b 100644
--- a/test/color/test_histogram.py
+++ b/test/color/test_histogram.py
@@ -1,5 +1,4 @@
import pytest
-from test.common import device
import numpy as np
import torch
from torch.testing import assert_allclose
diff --git a/test/color/test_hls.py b/test/color/test_hls.py
index 28b0f75cc..3f6da2617 100644
--- a/test/color/test_hls.py
+++ b/test/color/test_hls.py
@@ -3,7 +3,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
from kornia.constants import pi
-from test.common import device
import math
diff --git a/test/color/test_hsv.py b/test/color/test_hsv.py
index 24749f37b..b74ad44a6 100644
--- a/test/color/test_hsv.py
+++ b/test/color/test_hsv.py
@@ -3,7 +3,6 @@ import pytest
import kornia
from kornia.constants import pi
import kornia.testing as utils # test utils
-from test.common import device
import math
diff --git a/test/color/test_luv.py b/test/color/test_luv.py
index a8a764652..bbf467c8c 100644
--- a/test/color/test_luv.py
+++ b/test/color/test_luv.py
@@ -6,7 +6,6 @@ import kornia.testing as utils # test utils
import torch
from torch.autograd import gradcheck
from torch.testing import assert_allclose
-from test.common import device
class TestRgbToLuv:
diff --git a/test/color/test_normalize.py b/test/color/test_normalize.py
index 83bfa0829..fb1a2bf0e 100644
--- a/test/color/test_normalize.py
+++ b/test/color/test_normalize.py
@@ -2,7 +2,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/color/test_rgb.py b/test/color/test_rgb.py
index 79427e377..2befb3957 100644
--- a/test/color/test_rgb.py
+++ b/test/color/test_rgb.py
@@ -1,6 +1,5 @@
import kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/color/test_xyz.py b/test/color/test_xyz.py
index 583644d29..f1d6ff8fb 100644
--- a/test/color/test_xyz.py
+++ b/test/color/test_xyz.py
@@ -6,7 +6,6 @@ import kornia.testing as utils # test utils
import torch
from torch.autograd import gradcheck
from torch.testing import assert_allclose
-from test.common import device
class TestRgbToXyz:
diff --git a/test/color/test_yuv.py b/test/color/test_yuv.py
index 291872207..503be6d4d 100644
--- a/test/color/test_yuv.py
+++ b/test/color/test_yuv.py
@@ -2,7 +2,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/color/test_zca.py b/test/color/test_zca.py
index 12745a9fe..52ea6f413 100644
--- a/test/color/test_zca.py
+++ b/test/color/test_zca.py
@@ -8,7 +8,6 @@ import kornia.testing as utils # test utils
import torch
from torch.autograd import gradcheck
from torch.testing import assert_allclose
-from test.common import device, dtype
class TestZCA:
diff --git a/test/common.py b/test/common.py
deleted file mode 100644
index 17c72ff2a..000000000
--- a/test/common.py
+++ /dev/null
@@ -1,51 +0,0 @@
-from typing import Dict
-
-import torch
-import pytest
-
-
-def get_test_devices() -> Dict[str, torch.device]:
- """Creates a dictionary with the devices to test the source code.
- CUDA devices will be test only in case the current hardware supports it.
-
- Return:
- dict(str, torch.device): list with devices names.
- """
- devices: Dict[str, torch.device] = {}
- devices["cpu"] = torch.device("cpu")
- if torch.cuda.is_available():
- devices["cuda"] = torch.device("cuda:0")
- return devices
-
-
-def get_test_dtypes() -> Dict[str, torch.dtype]:
- """Creates a dictionary with the dtypes the source code.
-
- Return:
- dict(str, torch.dtype): list with dtype names.
- """
- dtypes: Dict[str, torch.dtype] = {}
- dtypes["float16"] = torch.float16
- dtypes["float32"] = torch.float32
- dtypes["float64"] = torch.float64
- return dtypes
-
-
-# setup the devices to test the source code
-
-TEST_DEVICES: Dict[str, torch.device] = get_test_devices()
-TEST_DTYPES: Dict[str, torch.dtype] = get_test_dtypes()
-
-
-def device(device_name) -> torch.device:
- if device_name not in TEST_DEVICES:
- pytest.skip(f"Unsupported device type: {device_name}")
- return TEST_DEVICES[device_name]
-
-
-def dtype(device, dtype_name) -> torch.dtype:
- if device.type == 'cpu' and dtype_name == 'float16':
- pytest.skip(f"Unsupported device cpu and dtype float16.")
- return TEST_DTYPES[dtype_name]
diff --git a/test/feature/test_affine_shape_estimator.py b/test/feature/test_affine_shape_estimator.py
index acb32cb0f..f5f01d7e5 100644
--- a/test/feature/test_affine_shape_estimator.py
+++ b/test/feature/test_affine_shape_estimator.py
@@ -1,7 +1,6 @@
import pytest
import kornia.testing as utils # test utils
import kornia
-from test.common import device
from torch.testing import assert_allclose
from torch.autograd import gradcheck
diff --git a/test/feature/test_hardnet.py b/test/feature/test_hardnet.py
index f89e4d138..61dadfb85 100644
--- a/test/feature/test_hardnet.py
+++ b/test/feature/test_hardnet.py
@@ -1,5 +1,4 @@
import pytest
-from test.common import device
import torch
from torch.testing import assert_allclose
diff --git a/test/feature/test_laf.py b/test/feature/test_laf.py
index 2939dacbe..d7f7b26cc 100644
--- a/test/feature/test_laf.py
+++ b/test/feature/test_laf.py
@@ -3,7 +3,6 @@ import pytest
import kornia as kornia
import kornia.geometry.transform.imgwarp
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.testing import assert_allclose
diff --git a/test/feature/test_local_features_orientation.py b/test/feature/test_local_features_orientation.py
index 9468988d1..738fa656e 100644
--- a/test/feature/test_local_features_orientation.py
+++ b/test/feature/test_local_features_orientation.py
@@ -1,7 +1,6 @@
import pytest
import kornia.testing as utils # test utils
import kornia
-from test.common import device
from torch.testing import assert_allclose
from torch.autograd import gradcheck
diff --git a/test/feature/test_nms.py b/test/feature/test_nms.py
index 2bf2b1a9d..a2fe76fa0 100644
--- a/test/feature/test_nms.py
+++ b/test/feature/test_nms.py
@@ -2,7 +2,6 @@ import pytest
import kornia as kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.testing import assert_allclose
diff --git a/test/feature/test_responces_local_features.py b/test/feature/test_responces_local_features.py
index ea6825097..159be72d7 100644
--- a/test/feature/test_responces_local_features.py
+++ b/test/feature/test_responces_local_features.py
@@ -2,7 +2,6 @@ import pytest
import kornia as kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.testing import assert_allclose
diff --git a/test/feature/test_scale_space_detector.py b/test/feature/test_scale_space_detector.py
index 2d384c5a5..870f19cee 100644
--- a/test/feature/test_scale_space_detector.py
+++ b/test/feature/test_scale_space_detector.py
@@ -2,7 +2,6 @@ import pytest
import torch
import kornia.testing as utils # test utils
import kornia
-from test.common import device
from torch.testing import assert_allclose
from torch.autograd import gradcheck
diff --git a/test/feature/test_siftdesc.py b/test/feature/test_siftdesc.py
index 3456773d0..07f2cb436 100644
--- a/test/feature/test_siftdesc.py
+++ b/test/feature/test_siftdesc.py
@@ -1,6 +1,5 @@
import pytest
import kornia.testing as utils # test utils
-from test.common import device
from torch.testing import assert_allclose
from torch.autograd import gradcheck
diff --git a/test/feature/test_sosnet.py b/test/feature/test_sosnet.py
index 18a162ebb..dc769df01 100644
--- a/test/feature/test_sosnet.py
+++ b/test/feature/test_sosnet.py
@@ -1,5 +1,4 @@
import pytest
-from test.common import device
import torch
from torch.testing import assert_allclose
diff --git a/test/filters/test_blur.py b/test/filters/test_blur.py
index ed7a9cfeb..b9c837b74 100644
--- a/test/filters/test_blur.py
+++ b/test/filters/test_blur.py
@@ -4,7 +4,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.testing import assert_allclose
diff --git a/test/filters/test_filters.py b/test/filters/test_filters.py
index 67787bbf0..01202763c 100644
--- a/test/filters/test_filters.py
+++ b/test/filters/test_filters.py
@@ -2,7 +2,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/filters/test_gaussian.py b/test/filters/test_gaussian.py
index c52574700..67014a94a 100644
--- a/test/filters/test_gaussian.py
+++ b/test/filters/test_gaussian.py
@@ -2,7 +2,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/filters/test_median.py b/test/filters/test_median.py
index c3e590b80..35b259cf7 100644
--- a/test/filters/test_median.py
+++ b/test/filters/test_median.py
@@ -4,7 +4,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.testing import assert_allclose
diff --git a/test/filters/test_motion.py b/test/filters/test_motion.py
index 18a0235aa..5d5068d43 100644
--- a/test/filters/test_motion.py
+++ b/test/filters/test_motion.py
@@ -3,7 +3,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/filters/test_sobel.py b/test/filters/test_sobel.py
index 8044f2641..91c39d494 100644
--- a/test/filters/test_sobel.py
+++ b/test/filters/test_sobel.py
@@ -2,7 +2,6 @@ import pytest
import kornia as kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.testing import assert_allclose
diff --git a/test/geometry/test_conversions.py b/test/geometry/test_conversions.py
index c23d893b8..05edbca79 100644
--- a/test/geometry/test_conversions.py
+++ b/test/geometry/test_conversions.py
@@ -5,7 +5,6 @@ import numpy as np
import kornia
from kornia.testing import tensor_to_gradcheck_var, create_eye_batch
-from test.common import device, dtype
import torch
from torch.autograd import gradcheck
diff --git a/test/geometry/test_depth.py b/test/geometry/test_depth.py
index a6fd0ce8c..a3b6c2bf3 100644
--- a/test/geometry/test_depth.py
+++ b/test/geometry/test_depth.py
@@ -2,7 +2,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/geometry/test_dsnt.py b/test/geometry/test_dsnt.py
index 2c73f5f14..1750bccbc 100644
--- a/test/geometry/test_dsnt.py
+++ b/test/geometry/test_dsnt.py
@@ -1,7 +1,6 @@
import pytest
import kornia as kornia
-from test.common import dtype, device
import torch
from torch.testing import assert_allclose
diff --git a/test/geometry/test_linalg.py b/test/geometry/test_linalg.py
index 353b57e12..af9c97ce8 100644
--- a/test/geometry/test_linalg.py
+++ b/test/geometry/test_linalg.py
@@ -2,7 +2,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/geometry/test_perspective.py b/test/geometry/test_perspective.py
index cb1b86324..0621d5d55 100644
--- a/test/geometry/test_perspective.py
+++ b/test/geometry/test_perspective.py
@@ -2,7 +2,6 @@ import pytest
import kornia
from kornia.testing import tensor_to_gradcheck_var
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/geometry/test_pinhole.py b/test/geometry/test_pinhole.py
index a7e8d8b0b..eb7448e3d 100644
--- a/test/geometry/test_pinhole.py
+++ b/test/geometry/test_pinhole.py
@@ -2,7 +2,6 @@ import pytest
import kornia as kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/geometry/test_spatial_softargmax.py b/test/geometry/test_spatial_softargmax.py
index d0d99623d..9bc20d13a 100644
--- a/test/geometry/test_spatial_softargmax.py
+++ b/test/geometry/test_spatial_softargmax.py
@@ -2,7 +2,6 @@ import pytest
import kornia as kornia
import kornia.testing as utils # test utils
-from test.common import device, dtype
import torch
from torch.nn.functional import mse_loss
diff --git a/test/geometry/transform/test_affine.py b/test/geometry/transform/test_affine.py
index eea458238..61a51b33d 100644
--- a/test/geometry/transform/test_affine.py
+++ b/test/geometry/transform/test_affine.py
@@ -1,7 +1,6 @@
import pytest
import kornia as kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/geometry/transform/test_crop.py b/test/geometry/transform/test_crop.py
index 396cb18f0..37db96693 100644
--- a/test/geometry/transform/test_crop.py
+++ b/test/geometry/transform/test_crop.py
@@ -4,7 +4,6 @@ import pytest
import kornia as kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.testing import assert_allclose
diff --git a/test/geometry/transform/test_flip.py b/test/geometry/transform/test_flip.py
index dffeb7f1b..8fd846022 100644
--- a/test/geometry/transform/test_flip.py
+++ b/test/geometry/transform/test_flip.py
@@ -3,7 +3,6 @@ import torch
import pytest
import kornia.testing as utils # test utils
-from test.common import device
from torch.testing import assert_allclose
from torch.autograd import gradcheck
diff --git a/test/geometry/transform/test_imgwarp.py b/test/geometry/transform/test_imgwarp.py
index bf75447ee..493addc18 100644
--- a/test/geometry/transform/test_imgwarp.py
+++ b/test/geometry/transform/test_imgwarp.py
@@ -2,7 +2,6 @@ import pytest
import kornia as kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/geometry/transform/test_pyramid.py b/test/geometry/transform/test_pyramid.py
index 1ae41f840..c35c475d0 100644
--- a/test/geometry/transform/test_pyramid.py
+++ b/test/geometry/transform/test_pyramid.py
@@ -2,7 +2,6 @@ import pytest
import kornia as kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.testing import assert_allclose
diff --git a/test/geometry/warp/test_depth_warper.py b/test/geometry/warp/test_depth_warper.py
index 723f511f8..ec98905e9 100644
--- a/test/geometry/warp/test_depth_warper.py
+++ b/test/geometry/warp/test_depth_warper.py
@@ -3,7 +3,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
from kornia.geometry.conversions import normalize_pixel_coordinates
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/geometry/warp/test_homography_warper.py b/test/geometry/warp/test_homography_warper.py
index 98b544401..906d49fca 100644
--- a/test/geometry/warp/test_homography_warper.py
+++ b/test/geometry/warp/test_homography_warper.py
@@ -2,7 +2,6 @@ import pytest
import kornia as kornia
import kornia.testing as utils # test utils
-from test.common import device
import torch
from torch.autograd import gradcheck
diff --git a/test/integration/test_focal.py b/test/integration/test_focal.py
index 897ff7e42..a8e7783ae 100644
--- a/test/integration/test_focal.py
+++ b/test/integration/test_focal.py
@@ -5,7 +5,6 @@ import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
-from test.common import device
import kornia
diff --git a/test/integration/test_soft_argmax2d.py b/test/integration/test_soft_argmax2d.py
index 5ef4998a2..71f844498 100644
--- a/test/integration/test_soft_argmax2d.py
+++ b/test/integration/test_soft_argmax2d.py
@@ -1,6 +1,5 @@
import logging
import pytest
-from test.common import device
import torch
import torch.nn as nn
diff --git a/test/integration/test_warp.py b/test/integration/test_warp.py
index 40bfcc46e..08a4b0fca 100644
--- a/test/integration/test_warp.py
+++ b/test/integration/test_warp.py
@@ -7,7 +7,6 @@ import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
-from test.common import device
class MyHomography(nn.Module):
diff --git a/test/performance/test_imgwarp_speed.py b/test/performance/test_imgwarp_speed.py
index ae1e9570e..c3cde6fd4 100644
--- a/test/performance/test_imgwarp_speed.py
+++ b/test/performance/test_imgwarp_speed.py
@@ -4,8 +4,6 @@ from time import time
import torch
import kornia as kornia
-from test.common import device, dtype
-
shapes = [(512, 3, 256, 256), (256, 1, 64, 64)]
PSs = [224, 32]
diff --git a/test/test_contrib.py b/test/test_contrib.py
index f82cf4c4a..204b11393 100644
--- a/test/test_contrib.py
+++ b/test/test_contrib.py
@@ -3,7 +3,6 @@ import pytest
import torch
from torch.autograd import gradcheck
from torch.testing import assert_allclose
-from test.common import device
import kornia
import kornia.testing as utils # test utils
diff --git a/test/test_losses.py b/test/test_losses.py
index 128f1704c..a56384dff 100644
--- a/test/test_losses.py
+++ b/test/test_losses.py
@@ -2,7 +2,6 @@ import pytest
import kornia
import kornia.testing as utils # test utils
-from test.common import device, dtype
import math
import torch
diff --git a/test/utils/test_image.py b/test/utils/test_image.py
index c5b919012..57a3ebe65 100644
--- a/test/utils/test_image.py
+++ b/test/utils/test_image.py
@@ -4,7 +4,6 @@ import numpy as np
import torch
import kornia as kornia
import kornia.testing as utils # test utils
-from test.common import device
@pytest.mark.parametrize("input_dtype, expected_dtype",