Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

lint errors

edgarribaeef9ee20a712
diff --git a/test/test_imgwarp.py b/test/test_imgwarp.py
index 85cb38777..e02c1c8fc 100644
--- a/test/test_imgwarp.py
+++ b/test/test_imgwarp.py
@@ -65,12 +65,12 @@ class Tester(unittest.TestCase):
# create points grid in normalized coordinates
grid_src_norm = tgm.create_meshgrid(src_h, src_w,
- normalized_coordinates=True)
+ normalized_coordinates=True)
grid_src_norm = torch.unsqueeze(grid_src_norm, dim=0)
# create points grid in pixel coordinates
grid_src_pix = tgm.create_meshgrid(src_h, src_w,
- normalized_coordinates=False)
+ normalized_coordinates=False)
grid_src_pix = torch.unsqueeze(grid_src_pix, dim=0)
src_norm_trans_src_pix = tgm.normal_transform_pixel(src_h, src_w)
@@ -85,8 +85,9 @@ class Tester(unittest.TestCase):
dst_norm_trans_dst_pix, grid_dst_pix)
# transform norm grid
- dst_norm_trans_src_norm = torch.matmul(dst_norm_trans_dst_pix,
- torch.matmul(dst_pix_trans_src_pix, src_pix_trans_src_norm))
+ dst_norm_trans_src_norm = torch.matmul(
+ dst_norm_trans_dst_pix, torch.matmul(
+ dst_pix_trans_src_pix, src_pix_trans_src_norm))
grid_dst_norm2 = tgm.transform_points(
dst_norm_trans_src_norm, grid_src_norm)
@@ -96,8 +97,8 @@ class Tester(unittest.TestCase):
# warp tensor
patch = torch.rand(batch_size, 1, src_h, src_w)
- patch_warped = tgm.warp_perspective(patch,
- dst_pix_trans_src_pix, (dst_h, dst_w))
+ patch_warped = tgm.warp_perspective(
+ patch, dst_pix_trans_src_pix, (dst_h, dst_w))
self.assertTrue(utils.check_equal_torch(
patch[:, :, :3, 1:3], patch_warped))
diff --git a/test/test_utils.py b/test/test_utils.py
index e7f7f3086..1ba5d75d9 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -43,10 +43,10 @@ class Tester(unittest.TestCase):
# create points grid
grid_norm = tgm.create_meshgrid(height, width,
- normalized_coordinates=True)
+ normalized_coordinates=True)
grid_norm = torch.unsqueeze(grid_norm, dim=0)
grid_pix = tgm.create_meshgrid(height, width,
- normalized_coordinates=False)
+ normalized_coordinates=False)
grid_pix = torch.unsqueeze(grid_pix, dim=0)
# grid from pixel space to normalized
@@ -59,6 +59,5 @@ class Tester(unittest.TestCase):
self.assertTrue(utils.check_equal_torch(grid_norm, grid_pix_to_norm))
-
if __name__ == '__main__':
unittest.main()
diff --git a/torchgeometry/imgwarp.py b/torchgeometry/imgwarp.py
index 82ad3cdf9..e3ec57f12 100644
--- a/torchgeometry/imgwarp.py
+++ b/torchgeometry/imgwarp.py
@@ -18,7 +18,7 @@ def normal_transform_pixel(height, width):
[2. / (width - 1), 0., -1.],
[0., 2. / (height - 1), -1.],
[0., 0., 1.]]
-]) # 1x3x3
+ ]) # 1x3x3
def dst_norm_to_dst_norm(dst_pix_trans_src_pix, dsize_src, dsize_dst):
@@ -35,8 +35,9 @@ def dst_norm_to_dst_norm(dst_pix_trans_src_pix, dsize_src, dsize_dst):
dst_norm_trans_dst_pix = normal_transform_pixel(
dst_h, dst_w).to(device).to(dtype)
# compute chain transformations
- dst_norm_trans_src_norm = torch.matmul(dst_norm_trans_dst_pix,
- torch.matmul(dst_pix_trans_src_pix, src_pix_trans_src_norm))
+ dst_norm_trans_src_norm = torch.matmul(
+ dst_norm_trans_dst_pix, torch.matmul(
+ dst_pix_trans_src_pix, src_pix_trans_src_norm))
return dst_norm_trans_src_norm