Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Fix tests on CUDA (#2098)

João Gustavo A. Amorimafa58c56cd57
diff --git a/setup.cfg b/setup.cfg
index 718f31e5e..93d2d656f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -98,7 +98,6 @@ norecursedirs =
dist
build
addopts =
- --strict
--color=yes
markers =
jit: mark a test as torchscript test
diff --git a/test/filters/test_filters.py b/test/filters/test_filters.py
index 331177b46..a0bea0396 100644
--- a/test/filters/test_filters.py
+++ b/test/filters/test_filters.py
@@ -640,10 +640,10 @@ class TestDexiNed:
def test_inference(self, device, dtype, data):
model = kornia.filters.DexiNed(pretrained=False)
model.load_state_dict(data, strict=True)
- model.eval()
model = model.to(device, dtype)
+ model.eval()
- img = torch.tensor([[[[0, 255, 0], [0, 255, 0], [0, 255, 0]]]], device=device, dtype=dtype)
+ img = torch.tensor([[[[0.0, 255.0, 0.0], [0.0, 255.0, 0.0], [0.0, 255.0, 0.0]]]], device=device, dtype=dtype)
img = img.repeat(1, 3, 1, 1)
expect = torch.tensor(
@@ -652,8 +652,8 @@ class TestDexiNed:
dtype=dtype,
)
- out = model(img)
- assert_close(out[-1][:, :1], expect, atol=1e-4, rtol=1e-4)
+ out = model(img)[-1]
+ assert_close(out, expect, atol=3e-4, rtol=3e-4)
def test_jit(self, device, dtype):
op = kornia.filters.DexiNed(pretrained=False).to(device, dtype)
diff --git a/test/geometry/epipolar/test_fundamental.py b/test/geometry/epipolar/test_fundamental.py
index 7738618e9..e0dbe7c6b 100644
--- a/test/geometry/epipolar/test_fundamental.py
+++ b/test/geometry/epipolar/test_fundamental.py
@@ -212,7 +212,7 @@ class TestComputeCorrespondEpilines:
lines_T_hops[:, i, ...] = epi.compute_correspond_epilines(point[:, i, ...], F_mat[:, i, ...])
lines_one_hop = epi.compute_correspond_epilines(point, F_mat)
- assert_close(lines_T_hops, lines_one_hop, atol=1e-8, rtol=1e-8)
+ assert_close(lines_T_hops, lines_one_hop, atol=2e-7, rtol=2e-7)
def test_opencv(self, device, dtype):
point = torch.rand(1, 2, 2, device=device, dtype=dtype)
diff --git a/test/utils/test_one_hot.py b/test/utils/test_one_hot.py
index 0a3c56866..7b7aa0c53 100644
--- a/test/utils/test_one_hot.py
+++ b/test/utils/test_one_hot.py
@@ -7,7 +7,7 @@ from kornia.testing import assert_close
class TestOneHot:
def test_smoke(self, device, dtype):
num_classes = 4
- labels = torch.zeros(2, 2, 1, dtype=torch.int64)
+ labels = torch.zeros(2, 2, 1, dtype=torch.int64, device=device)
labels[0, 0, 0] = 0
labels[0, 1, 0] = 1
labels[1, 0, 0] = 2