Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

update to pytorch 1.3 and fix small test issues

edgarribac254bf2c0b91
diff --git a/requirements.txt b/requirements.txt
index 27159b278..2e7784cd5 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,8 +1,8 @@
# core dependencies
-pytorch==1.2.0
+pytorch==1.3.0
# utils
-torchvision==0.4.0
+torchvision==0.4.1
opencv==4.1.1
ipython==7.8.0
jupyter==1.0.0
diff --git a/test/geometry/test_pinhole.py b/test/geometry/test_pinhole.py
index 3b2a3bb13..ebe31bbad 100644
--- a/test/geometry/test_pinhole.py
+++ b/test/geometry/test_pinhole.py
@@ -11,19 +11,19 @@ from torch.testing import assert_allclose
class TestPinholeCamera:
def _create_intrinsics(self, batch_size, fx, fy, cx, cy):
- intrinsics = torch.eye(4).expand(batch_size, -1, -1)
+ intrinsics = torch.eye(4)
intrinsics[..., 0, 0] = fx
intrinsics[..., 1, 1] = fy
intrinsics[..., 0, 2] = cx
intrinsics[..., 1, 2] = cy
- return intrinsics
+ return intrinsics.expand(batch_size, -1, -1)
def _create_extrinsics(self, batch_size, tx, ty, tz):
- extrinsics = torch.eye(4).expand(batch_size, -1, -1)
+ extrinsics = torch.eye(4)
extrinsics[..., 0, -1] = tx
extrinsics[..., 1, -1] = ty
extrinsics[..., 2, -1] = tz
- return extrinsics
+ return extrinsics.expand(batch_size, -1, -1)
def test_smoke(self):
intrinsics = torch.eye(4)[None]
diff --git a/test/geometry/warp/test_homography_warper.py b/test/geometry/warp/test_homography_warper.py
index 21b21a0c1..f0cd833aa 100644
--- a/test/geometry/warp/test_homography_warper.py
+++ b/test/geometry/warp/test_homography_warper.py
@@ -93,11 +93,12 @@ class TestHomographyWarper:
batch_size, channels, height, width = batch_shape
patch_src = torch.rand(batch_size, channels, height, width)
# rotation of 90deg
- dst_homo_src = utils.create_eye_batch(batch_size, 3)
+ dst_homo_src = torch.eye(3)
dst_homo_src[..., 0, 0] = 0.0
dst_homo_src[..., 0, 1] = 1.0
dst_homo_src[..., 1, 0] = -1.0
dst_homo_src[..., 1, 1] = 0.0
+ dst_homo_src = dst_homo_src.expand(batch_size, -1, -1)
# instantiate warper and warp from source to destination
warper = kornia.HomographyWarper(height, width)