Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Debug flake8 warnings.

Onur Kaplan45592db34e17
diff --git a/torchgeometry/conversions.py b/torchgeometry/conversions.py
index d215cf052..ea256ea2b 100644
--- a/torchgeometry/conversions.py
+++ b/torchgeometry/conversions.py
@@ -116,7 +116,8 @@ def convert_points_to_homogeneous(points):
points.shape))
if torch.is_tensor(points.shape[-1]):
- last_dim_bit_length = torch.floor(torch.log2(points.shape[-1].float())) + 1
+ last_dim_shape = points.shape[-1].float()
+ last_dim_bit_length = torch.floor(torch.log2(last_dim_shape)) + 1
last_dim_bit_length = last_dim_bit_length.long()
else:
last_dim_bit_length = points.shape[-1].bit_length()
diff --git a/torchgeometry/imgwarp.py b/torchgeometry/imgwarp.py
index 4fd248a1d..010b4d976 100644
--- a/torchgeometry/imgwarp.py
+++ b/torchgeometry/imgwarp.py
@@ -16,11 +16,9 @@ __all__ = [
def normal_transform_pixel(height, width):
- tr_mat = torch.Tensor([
- [1.0, 0.0, -1.0],
- [0.0, 1.0, -1.0],
- [0.0, 0.0, 1.0]
- ]) # 1x3x3
+ tr_mat = torch.Tensor([[1.0, 0.0, -1.0],
+ [0.0, 1.0, -1.0],
+ [0.0, 0.0, 1.0]]) # 1x3x3
tr_mat[0, 0] = tr_mat[0, 0] * 2.0 / (width - 1.0)
tr_mat[1, 1] = tr_mat[1, 1] * 2.0 / (height - 1.0)