π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
test(geometry): resolve Ruff PT007 parametrization violations (#5132)
Daniele Loruf4c46069ec92
diff --git a/tests/geometry/calibration/test_pnp.py b/tests/geometry/calibration/test_pnp.pyindex 0a9455b1c..64962c103 100644--- a/tests/geometry/calibration/test_pnp.py+++ b/tests/geometry/calibration/test_pnp.py@@ -104,7 +104,7 @@ class TestSolvePnpDlt(BaseTester):return intrinsics, world_to_cam_3x4, world_points, img_points- @pytest.mark.parametrize("num_points", (6, 20))+ @pytest.mark.parametrize("num_points", [6, 20])def test_smoke(self, num_points, device, dtype):intrinsics, _, world_points, img_points = self._get_test_data(num_points, device, dtype)batch_size = world_points.shape[0]@@ -112,31 +112,31 @@ class TestSolvePnpDlt(BaseTester):pred_world_to_cam = kornia.geometry.solve_pnp_dlt(world_points, img_points, intrinsics)assert pred_world_to_cam.shape == (batch_size, 3, 4)- @pytest.mark.parametrize("num_points", (6,))+ @pytest.mark.parametrize("num_points", [6])def test_gradcheck(self, num_points, device):intrinsics, _, world_points, img_points = self._get_test_data(num_points, device, torch.float64)self.gradcheck(kornia.geometry.solve_pnp_dlt, (world_points, img_points, intrinsics))- @pytest.mark.parametrize("num_points", (8,))+ @pytest.mark.parametrize("num_points", [8])def test_gradcheck_weights(self, num_points, device):intrinsics, _, world_points, img_points = self._get_test_data(num_points, device, torch.float64)weights = torch.rand(*world_points.shape[:2], device=device, dtype=torch.float64).abs()self.gradcheck(kornia.geometry.solve_pnp_dlt, (world_points, img_points, intrinsics, weights))- @pytest.mark.parametrize("num_points", (6, 20))+ @pytest.mark.parametrize("num_points", [6, 20])def test_pred_world_to_cam(self, num_points, device, dtype):intrinsics, gt_world_to_cam, world_points, img_points = self._get_test_data(num_points, device, dtype)pred_world_to_cam = kornia.geometry.solve_pnp_dlt(world_points, img_points, intrinsics)self.assert_close(pred_world_to_cam, gt_world_to_cam, atol=1e-4, rtol=1e-4)- @pytest.mark.parametrize("num_points", (16, 20))+ @pytest.mark.parametrize("num_points", [16, 20])def test_pred_world_to_cam_weighted(self, num_points, device, dtype):intrinsics, gt_world_to_cam, world_points, img_points = self._get_test_data(num_points, device, dtype)weights = torch.ones(*world_points.shape[:2], device=device, dtype=dtype)pred_world_to_cam = kornia.geometry.solve_pnp_dlt(world_points, img_points, intrinsics, weights)self.assert_close(pred_world_to_cam, gt_world_to_cam, atol=1e-4, rtol=1e-4)- @pytest.mark.parametrize("num_points", (25,))+ @pytest.mark.parametrize("num_points", [25])def test_pred_world_to_cam_weighted_rand(self, num_points, device, dtype):torch.manual_seed(0)intrinsics, gt_world_to_cam, world_points, img_points = self._get_test_data(num_points, device, dtype)@@ -147,7 +147,7 @@ class TestSolvePnpDlt(BaseTester):pred_world_to_cam = kornia.geometry.solve_pnp_dlt(world_points, img_points, intrinsics, weights)self.assert_close(pred_world_to_cam, gt_world_to_cam, atol=1e-4, rtol=1e-3)- @pytest.mark.parametrize("num_points", (6, 20))+ @pytest.mark.parametrize("num_points", [6, 20])def test_project(self, num_points, device, dtype):intrinsics, _, world_points, img_points = self._get_test_data(num_points, device, dtype)@@ -381,7 +381,7 @@ class TestSolvePnpDlt(BaseTester):class TestNormalization(BaseTester):- @pytest.mark.parametrize("dimension", (2, 3, 5))+ @pytest.mark.parametrize("dimension", [2, 3, 5])def test_smoke(self, dimension, device, dtype):batch_size = 10num_points = 100@@ -391,7 +391,7 @@ class TestNormalization(BaseTester):assert points_norm.shape == (batch_size, num_points, dimension)assert transform.shape == (batch_size, dimension + 1, dimension + 1)- @pytest.mark.parametrize("dimension", (2, 3, 5))+ @pytest.mark.parametrize("dimension", [2, 3, 5])def test_gradcheck(self, dimension, device):batch_size = 3num_points = 5diff --git a/tests/geometry/camera/test_pinhole.py b/tests/geometry/camera/test_pinhole.pyindex a9c43dbeb..346aa20f3 100644--- a/tests/geometry/camera/test_pinhole.py+++ b/tests/geometry/camera/test_pinhole.py@@ -74,7 +74,7 @@ class TestCam2Pixel(BaseTester):"""Return a tensor having the given shape and whose values are in the range [low, high)"""return ((high - low) * torch.rand(shape, device=device, dtype=dtype)) + low- @pytest.mark.parametrize("batch_size", (1,))+ @pytest.mark.parametrize("batch_size", [1])def test_smoke(self, batch_size, device, dtype):H, W = 250, 500fx, fy = W, H@@ -97,7 +97,7 @@ class TestCam2Pixel(BaseTester):)assert pixel_coords_dst.shape == (batch_size, H, W, 2)- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_consistency(self, batch_size, device, dtype):H, W = 250, 500fx, fy = W, H@@ -136,7 +136,7 @@ class TestCam2Pixel(BaseTester):self.assert_close(cam_coords_output, cam_coords_input, atol=1e-4, rtol=1e-4)- @pytest.mark.parametrize("batch_size", (1,))+ @pytest.mark.parametrize("batch_size", [1])def test_gradcheck(self, batch_size, device):dtype = torch.float64H, W = 10, 20@@ -224,7 +224,7 @@ class TestPixel2Cam(BaseTester):"""Return a tensor having the given shape and whose values are in the range [low, high)"""return ((high - low) * torch.rand(shape, device=device, dtype=dtype)) + low- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_smoke(self, batch_size, device, dtype):H, W = 250, 500fx, fy = W, H@@ -248,7 +248,7 @@ class TestPixel2Cam(BaseTester):assert output.shape == (batch_size, H, W, 3)- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_consistency(self, batch_size, device, dtype):H, W = 250, 500fx, fy = W, H@@ -288,7 +288,7 @@ class TestPixel2Cam(BaseTester):self.assert_close(pixel_coords_concat, pixel_coords_input, atol=1e-4, rtol=1e-4)- @pytest.mark.parametrize("batch_size", (1,))+ @pytest.mark.parametrize("batch_size", [1])@pytest.mark.slowdef test_gradcheck(self, batch_size, device):dtype = torch.float64@@ -524,7 +524,7 @@ class TestPinholeCamera(BaseTester):assert pinhole.rotation_matrix.shape == (batch_size, 3, 3)assert pinhole.translation_vector.shape == (batch_size, 3, 1)- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_from_parameters(self, batch_size, device, dtype):height, width = 6, 8fx = torch.arange(1, batch_size + 1, device=device, dtype=dtype) * 100.0diff --git a/tests/geometry/liegroup/test_se2.py b/tests/geometry/liegroup/test_se2.pyindex bc1a85ea0..ae64ca844 100644--- a/tests/geometry/liegroup/test_se2.py+++ b/tests/geometry/liegroup/test_se2.py@@ -64,7 +64,7 @@ class TestSe2(BaseTester):assert s.inverse().so2.z.shape == input_shapeassert s.inverse().t.shape == t_input_shape- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_exception(self, device, dtype, batch_size):r = So2.random(batch_size)t1 = torch.randn((batch_size, 1), dtype=dtype, device=device)@@ -126,7 +126,7 @@ class TestSe2(BaseTester):def test_module(self, device, dtype):pass- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_init(self, device, dtype, batch_size):s1 = Se2.random(batch_size, device, dtype)s2 = Se2(s1.r, s1.t)@@ -134,7 +134,7 @@ class TestSe2(BaseTester):self.assert_close(s1.r.z, s2.r.z)self.assert_close(s1.t, s2.t)- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_getitem(self, device, dtype, batch_size):z = torch.rand(batch_size, dtype=torch.cfloat, device=device)t = torch.rand((batch_size, 2), device=device, dtype=dtype)@@ -144,7 +144,7 @@ class TestSe2(BaseTester):self.assert_close(s1.r.z, z[i])self.assert_close(s1.t, t[i])- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_mul(self, device, dtype, batch_size):s1 = Se2.identity(batch_size, device, dtype)s2 = Se2.random(batch_size, device, dtype)@@ -160,7 +160,7 @@ class TestSe2(BaseTester):self.assert_close(s2_pose_s2.r.z.imag, so2_expected.z.imag)self.assert_close(s2_pose_s2.t, zeros_vec)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_mul_vector(self, device, dtype, batch_size):s1 = Se2.identity(batch_size, device, dtype)if batch_size is None:@@ -180,7 +180,7 @@ class TestSe2(BaseTester):self.assert_close(s2_pose_s2.r.z.imag, so2_expected.z.imag)self.assert_close(s2_pose_s2.t, zeros_vec)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_exp(self, device, dtype, batch_size):t = self._make_rand_data(device, dtype, (batch_size, 2))theta = torch.zeros(batch_size if batch_size is not None else (), device=device, dtype=dtype)@@ -189,14 +189,14 @@ class TestSe2(BaseTester):# V(0) is the identity, so a pure translation keeps its translation (#4924)self.assert_close(s.t, t)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_log(self, device, dtype, batch_size):t = self._make_rand_data(device, dtype, (batch_size, 2))s = Se2(So2.identity(batch_size, device, dtype), t)# V(0)^-1 is the identity, so the log of a pure translation is (t, 0) (#4924)self.assert_close(s.log(), torch.cat((t, torch.zeros_like(t[..., :1])), -1))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_exp_log(self, device, dtype, batch_size):a = self._make_rand_data(device, dtype, (batch_size, 3))b = Se2.exp(a).log()@@ -282,7 +282,7 @@ class TestSe2(BaseTester):g = Se2(So2.exp(v[..., 2]), t_ref) # the element exp(v), rounded to dtypeself.assert_close(g.log(), v, rtol=8 * eps, atol=8 * eps)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_wart_se2_hat_and_vee_layout_4929(self, device, dtype, batch_size):# https://github.com/kornia/kornia/issues/4929: hat places translation in the bottom row and has a symmetric# rotation block; vee reads that same non-generator layout, so vee(hat(v)) conceals the defect.@@ -297,7 +297,7 @@ class TestSe2(BaseTester):self.assert_close(recovered[..., -1], omega[..., 0, 1])self.assert_close(Se2.vee(s_hat), torch.cat((v, theta), -1))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_identity(self, device, dtype, batch_size):s = Se2.random(batch_size)s_pose_s = s * Se2.identity(batch_size)@@ -305,7 +305,7 @@ class TestSe2(BaseTester):self.assert_close(s_pose_s.so2.z.imag, s.so2.z.imag)self.assert_close(s.t, s_pose_s.t)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_matrix(self, device, dtype, batch_size):theta = self._make_rand_data(device, dtype, (batch_size,))t = self._make_rand_data(device, dtype, (batch_size, 2))@@ -314,7 +314,7 @@ class TestSe2(BaseTester):p2 = s.matrix() @ t[..., None]self.assert_close(p1, p2.squeeze(-1))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_from_matrix(self, device, dtype, batch_size):theta = self._make_rand_data(device, dtype, (batch_size,))t = self._make_rand_data(device, dtype, (batch_size, 2))@@ -327,7 +327,7 @@ class TestSe2(BaseTester):p2 = Se2.from_matrix(RT) * tself.assert_close(p1, p2)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_inverse(self, device, batch_size, dtype):s = Se2.random(batch_size, device, dtype)s_in_in = s.inverse().inverse()@@ -335,7 +335,7 @@ class TestSe2(BaseTester):self.assert_close(s_in_in.so2.z.imag, s.so2.z.imag)self.assert_close(s_in_in.t, s.t)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_random(self, device, dtype, batch_size):s = So2.random(batch_size=batch_size, device=device, dtype=dtype)t = self._make_rand_data(device, dtype, (batch_size, 2))@@ -356,7 +356,7 @@ class TestSe2(BaseTester):theta = z.imag.atan2(z.real)assert theta.min() < -math.pi / 2 and theta.max() > math.pi / 2, (theta.min(), theta.max())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_trans(self, device, dtype, batch_size):trans = self._make_rand_data(device, dtype, (batch_size, 2))x, y = trans[..., 0], trans[..., 1]@@ -364,7 +364,7 @@ class TestSe2(BaseTester):self.assert_close(se2.t, trans)self.assert_close(se2.so2.matrix(), So2.identity(batch_size, device, dtype).matrix())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_trans_x(self, device, dtype, batch_size):x = self._make_rand_data(device, dtype, (batch_size, 1)).squeeze(-1)zs = torch.zeros_like(x)@@ -372,7 +372,7 @@ class TestSe2(BaseTester):self.assert_close(se2.t, torch.stack((x, zs), -1))self.assert_close(se2.so2.matrix(), So2.identity(batch_size, device, dtype).matrix())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_trans_y(self, device, dtype, batch_size):y = self._make_rand_data(device, dtype, (batch_size, 1)).squeeze(-1)zs = torch.zeros_like(y)@@ -380,7 +380,7 @@ class TestSe2(BaseTester):self.assert_close(se2.t, torch.stack((zs, y), -1))self.assert_close(se2.so2.matrix(), So2.identity(batch_size, device, dtype).matrix())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_adjoint(self, device, dtype, batch_size):x = Se2.random(batch_size)y = Se2.random(batch_size)diff --git a/tests/geometry/liegroup/test_se3.py b/tests/geometry/liegroup/test_se3.pyindex afa6f104b..112cef5f5 100644--- a/tests/geometry/liegroup/test_se3.py+++ b/tests/geometry/liegroup/test_se3.py@@ -57,7 +57,7 @@ class TestSe3(BaseTester):self.assert_close(s.r.q.data, q.data)self.assert_close(s.t, t)- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_cardinality(self, device, dtype, batch_size):se: Se3 = self._make_rand_se3d(device, dtype, batch_size)assert se.r.q.shape[0] == batch_size@@ -119,7 +119,7 @@ class TestSe3(BaseTester):def test_module(self, device, dtype):pass- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_init(self, device, dtype, batch_size):s1: Se3 = self._make_rand_se3d(device, dtype, batch_size)s2 = Se3(s1.r, s1.t)@@ -127,7 +127,7 @@ class TestSe3(BaseTester):self.assert_close(s1.r.q.data, s2.r.q.data)self.assert_close(s1.t, s2.t)- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_getitem(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)t = torch.rand(batch_size, 3, device=device, dtype=dtype)@@ -137,7 +137,7 @@ class TestSe3(BaseTester):self.assert_close(s1.r.q.data, q.data[i])self.assert_close(s1.t, t[i])- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_mul(self, device, dtype, batch_size):s1 = Se3.identity(batch_size, device, dtype)s2: Se3 = self._make_rand_se3d(device, dtype, batch_size)@@ -152,7 +152,7 @@ class TestSe3(BaseTester):self.assert_close(s2s2inv.r.q.data, so3_expected.q.data)self.assert_close(s2s2inv.t, zeros_vec)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_mul_point(self, device, dtype, batch_size):world_pose_s1: Se3 = self._make_rand_se3d(device, dtype, batch_size)world_pose_s2: Se3 = self._make_rand_se3d(device, dtype, batch_size)@@ -165,7 +165,7 @@ class TestSe3(BaseTester):self.assert_close(pt_in_s1, pt_in_s2_in_s1)self.assert_close(pt_in_s2, pt_in_s1_in_s2)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_mul_vector(self, device, dtype, batch_size):world_pose_s1: Se3 = self._make_rand_se3d(device, dtype, batch_size)world_pose_s2: Se3 = self._make_rand_se3d_vec(device, dtype, batch_size)@@ -194,7 +194,7 @@ class TestSe3(BaseTester):self.assert_close(s4s4inv.r.q.data, so3_expected.q.data)self.assert_close(s4s4inv.t, zeros_vec)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_exp(self, device, dtype, batch_size):omega = torch.zeros(3, device=device, dtype=dtype)t = torch.rand(3, device=device, dtype=dtype)@@ -206,7 +206,7 @@ class TestSe3(BaseTester):self.assert_close(s.r.q.data, quat_expected.data)self.assert_close(s.t, t)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_log(self, device, dtype, batch_size):q = Quaternion.identity(batch_size, device, dtype)t = self._make_rand_data(device, dtype, batch_size, dims=3)@@ -249,20 +249,20 @@ class TestSe3(BaseTester):v = torch.tensor([[1.0, 2.0, 3.0, 0.6 * theta, 0.0, 0.8 * theta]], device=device, dtype=dtype)self.assert_close(Se3.exp(v).log(), v, rtol=rtol, atol=0.0)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_exp_log(self, device, dtype, batch_size):a = self._make_rand_data(device, dtype, batch_size, dims=6)b = Se3.exp(a).log()self.assert_close(b, a)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_hat_vee(self, device, dtype, batch_size):a = self._make_rand_data(device, dtype, batch_size, dims=6)omega_hat = Se3.hat(a)b = Se3.vee(omega_hat)self.assert_close(b, a)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_matrix(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)t = self._make_rand_data(device, dtype, batch_size, dims=3)@@ -275,7 +275,7 @@ class TestSe3(BaseTester):self.assert_close(rot_mat[..., 0:3, 0:3], rot.matrix())self.assert_close(rot_mat[..., 0:3, 3], t)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_from_matrix(self, device, dtype, batch_size):matrix = torch.tensor(((1.0, 0.0, 0.0, 0.0), (0.0, 0.0, -1.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 0.0, 1.0)),@@ -288,7 +288,7 @@ class TestSe3(BaseTester):self.assert_close(s.r.matrix(), matrix[..., 0:3, 0:3])self.assert_close(s.t, matrix[..., 0:3, 3])- @pytest.mark.parametrize("batch_size", (None, 1, 2))+ @pytest.mark.parametrize("batch_size", [None, 1, 2])def test_from_matrix_check_rotation(self, device, dtype, batch_size):# kornia#4773: the rotation block reaches rotation_matrix_to_quaternion, so a reflection# block is accepted by default and yields a non-unit quaternion. check_rotation=True has@@ -302,7 +302,7 @@ class TestSe3(BaseTester):with pytest.raises(ValueError, match="reflection"):Se3.from_matrix(matrix, check_rotation=True)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_from_matrix_check_rotation_accepts_rotation(self, device, dtype, batch_size):# A genuine rotation block passes, and the flag leaves both parts of the group element# alone. Comparing the checked call against the unchecked one rather than against the@@ -316,14 +316,14 @@ class TestSe3(BaseTester):self.assert_close(checked.r.q.data, unchecked.r.q.data)self.assert_close(checked.t, unchecked.t)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_from_qxyz(self, device, dtype, batch_size):qxyz = self._make_rand_data(device, dtype, batch_size, dims=7)s = Se3.from_qxyz(qxyz)self.assert_close(s.r.q.data, qxyz[..., :4].data)self.assert_close(s.t, qxyz[..., 4:])- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_inverse(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)rot = So3(q)@@ -332,7 +332,7 @@ class TestSe3(BaseTester):self.assert_close(sinv.r.inverse().q.data, q.data)self.assert_close(sinv.t, sinv.r * (-1 * t))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_rot_x(self, device, dtype, batch_size):x = self._make_rand_data(device, dtype, batch_size, dims=1).squeeze(-1)se3 = Se3.rot_x(x)@@ -342,7 +342,7 @@ class TestSe3(BaseTester):self.assert_close(x, roll)self.assert_close(se3.t, torch.zeros_like(se3.t))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_rot_y(self, device, dtype, batch_size):y = self._make_rand_data(device, dtype, batch_size, dims=1).squeeze(-1)se3 = Se3.rot_y(y)@@ -352,7 +352,7 @@ class TestSe3(BaseTester):self.assert_close(y, pitch)self.assert_close(se3.t, torch.zeros_like(se3.t))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_rot_z(self, device, dtype, batch_size):z = self._make_rand_data(device, dtype, batch_size, dims=1).squeeze(-1)se3 = Se3.rot_z(z)@@ -362,7 +362,7 @@ class TestSe3(BaseTester):self.assert_close(z, yaw)self.assert_close(se3.t, torch.zeros_like(se3.t))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_trans(self, device, dtype, batch_size):trans = self._make_rand_data(device, dtype, batch_size, dims=3)x, y, z = trans[..., 0], trans[..., 1], trans[..., 2]@@ -370,7 +370,7 @@ class TestSe3(BaseTester):self.assert_close(se3.t, trans)self.assert_close(se3.so3.matrix(), So3.identity(batch_size, device, dtype).matrix())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_trans_x(self, device, dtype, batch_size):x = self._make_rand_data(device, dtype, batch_size, dims=1).squeeze(-1)zs = torch.zeros_like(x)@@ -378,7 +378,7 @@ class TestSe3(BaseTester):self.assert_close(se3.t, torch.stack((x, zs, zs), -1))self.assert_close(se3.so3.matrix(), So3.identity(batch_size, device, dtype).matrix())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_trans_y(self, device, dtype, batch_size):y = self._make_rand_data(device, dtype, batch_size, dims=1).squeeze(-1)zs = torch.zeros_like(y)@@ -386,7 +386,7 @@ class TestSe3(BaseTester):self.assert_close(se3.t, torch.stack((zs, y, zs), -1))self.assert_close(se3.so3.matrix(), So3.identity(batch_size, device, dtype).matrix())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_trans_z(self, device, dtype, batch_size):z = self._make_rand_data(device, dtype, batch_size, dims=1).squeeze(-1)zs = torch.zeros_like(z)@@ -394,7 +394,7 @@ class TestSe3(BaseTester):self.assert_close(se3.t, torch.stack((zs, zs, z), -1))self.assert_close(se3.so3.matrix(), So3.identity(batch_size, device, dtype).matrix())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_adjoint(self, device, dtype, batch_size):shape = (6,) if batch_size is None else (batch_size, 6)x_data = torch.tensor([0.1, -0.2, 0.3, 0.2, -0.1, 0.1], device=device, dtype=dtype).expand(shape)@@ -408,7 +408,7 @@ class TestSe3(BaseTester):self.assert_close(adjoint @ inverse_adjoint, identity, rtol=half_tolerance, atol=half_tolerance)self.assert_close((x * y).adjoint(), adjoint @ y.adjoint(), rtol=half_tolerance, atol=half_tolerance)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_random(self, device, dtype, batch_size):s = Se3.random(batch_size=batch_size, device=device, dtype=dtype)s_in_s = s.inverse() * sdiff --git a/tests/geometry/liegroup/test_so2.py b/tests/geometry/liegroup/test_so2.pyindex 4f4aad7d0..b12b4105d 100644--- a/tests/geometry/liegroup/test_so2.py+++ b/tests/geometry/liegroup/test_so2.py@@ -34,7 +34,7 @@ class TestSo2(BaseTester):shape = input_shape[1:] if batch_size is None else input_shapereturn torch.rand(shape, device=device, dtype=dtype)- @pytest.mark.parametrize("cdtype", (torch.cfloat, torch.cdouble))+ @pytest.mark.parametrize("cdtype", [torch.cfloat, torch.cdouble])def test_smoke(self, device, cdtype):z = torch.randn(2, 1, dtype=cdtype, device=device)s = So2(z)@@ -43,7 +43,7 @@ class TestSo2(BaseTester):self.assert_close(s.z.data, z.data[:, 0])@pytest.mark.parametrize("input_shape", [(1,), (2,), (5,), ()])- @pytest.mark.parametrize("cdtype", (torch.cfloat, torch.cdouble))+ @pytest.mark.parametrize("cdtype", [torch.cfloat, torch.cdouble])def test_cardinality(self, device, dtype, input_shape, cdtype):z = torch.randn(input_shape, dtype=cdtype, device=device)s = So2(z)@@ -67,8 +67,8 @@ class TestSo2(BaseTester):s = So2.from_matrix(matrix)assert s.matrix().shape == input_shape- @pytest.mark.parametrize("batch_size", (1, 2, 5))- @pytest.mark.parametrize("cdtype", (torch.cfloat, torch.cdouble))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])+ @pytest.mark.parametrize("cdtype", [torch.cfloat, torch.cdouble])def test_exception(self, batch_size, device, dtype, cdtype):z = torch.randn(batch_size, 2, dtype=cdtype, device=device)with pytest.raises(ValueError):@@ -102,8 +102,8 @@ class TestSo2(BaseTester):def test_module(self, device, dtype):pass- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))- @pytest.mark.parametrize("cdtype", (torch.cfloat, torch.cdouble))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])+ @pytest.mark.parametrize("cdtype", [torch.cfloat, torch.cdouble])def test_init(self, device, dtype, batch_size, cdtype):z1 = self._make_rand_data(device, cdtype, (batch_size,))z2 = self._make_rand_data(device, cdtype, (batch_size, 1))@@ -118,8 +118,8 @@ class TestSo2(BaseTester):self.assert_close(So2(z2).z, z2.flatten()) # (B, 1) is squeezed to (B,); (1,) for batch_size None staysself.assert_close(So2(z3).z, z3)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))- @pytest.mark.parametrize("cdtype", (torch.cfloat, torch.cdouble))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])+ @pytest.mark.parametrize("cdtype", [torch.cfloat, torch.cdouble])def test_getitem(self, device, batch_size, cdtype):z = self._make_rand_data(device, cdtype, (batch_size,))s = So2(z)@@ -133,7 +133,7 @@ class TestSo2(BaseTester):actual = z[i]self.assert_close(expected, actual)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_mul(self, device, dtype, batch_size):s1 = So2.identity(batch_size, device, dtype)z = self._make_rand_data(device, dtype, (batch_size, 2))@@ -149,7 +149,7 @@ class TestSo2(BaseTester):self.assert_close((s1 * t1), t1)self.assert_close((So2.identity(device=device, dtype=dtype) * t2), t2)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_mul_vector(self, device, dtype, batch_size):s1 = So2.identity(batch_size, device, dtype)if batch_size is None:@@ -161,26 +161,26 @@ class TestSo2(BaseTester):self.assert_close((s1 * t1), t1)self.assert_close((So2.identity(device=device, dtype=dtype) * t2), t2)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_exp(self, device, dtype, batch_size):theta = self._make_rand_data(device, dtype, (batch_size, 1))s = So2.exp(theta)self.assert_close(s.z.real, theta.flatten().cos())self.assert_close(s.z.imag, theta.flatten().sin())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))- @pytest.mark.parametrize("cdtype", (torch.cfloat, torch.cdouble))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])+ @pytest.mark.parametrize("cdtype", [torch.cfloat, torch.cdouble])def test_log(self, device, batch_size, cdtype):z = self._make_rand_data(device, cdtype, (batch_size,))t = So2(z).log()self.assert_close(t, z.imag.atan2(z.real))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_exp_log(self, device, dtype, batch_size):theta = self._make_rand_data(device, dtype, (batch_size, 1))self.assert_close(So2.exp(theta).log(), theta.flatten())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_wart_so2_hat_and_vee_layout_4929(self, device, dtype, batch_size):# https://github.com/kornia/kornia/issues/4929: hat is symmetric rather than the so(2) generator and vee# reads its upper-right entry. Keep both layouts together because vee(hat(theta)) conceals the defect.@@ -192,7 +192,7 @@ class TestSo2(BaseTester):self.assert_close(So2.vee(omega), omega[..., 0, 1])self.assert_close(So2.vee(m), theta)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_matrix(self, device, dtype, batch_size):theta = self._make_rand_data(device, dtype, (batch_size,))t = self._make_rand_data(device, dtype, (batch_size, 2))@@ -201,7 +201,7 @@ class TestSo2(BaseTester):p2 = s.matrix() @ t[..., None]self.assert_close(p1, p2.squeeze(-1))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_from_matrix(self, device, dtype, batch_size):matrix = torch.eye(2, device=device, dtype=dtype)if batch_size is not None:@@ -215,8 +215,8 @@ class TestSo2(BaseTester):self.assert_close(s.z.real, one)self.assert_close(s.z.imag, zero)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))- @pytest.mark.parametrize("cdtype", (torch.cfloat, torch.cdouble))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])+ @pytest.mark.parametrize("cdtype", [torch.cfloat, torch.cdouble])def test_inverse(self, device, batch_size, cdtype):z = self._make_rand_data(device, cdtype, (batch_size,))s = So2(z)@@ -224,7 +224,7 @@ class TestSo2(BaseTester):self.assert_close(s_in_in.z.real, z.real)self.assert_close(s_in_in.z.imag, z.imag)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_random(self, device, dtype, batch_size):s = So2.random(batch_size=batch_size, device=device, dtype=dtype)s_in_s = s.inverse() * s@@ -252,7 +252,7 @@ class TestSo2(BaseTester):assert theta.min() < -torch.pi + 0.05 and theta.max() > torch.pi - 0.05, (theta.min(), theta.max())self.assert_close(So2.random(device=device, dtype=dtype).z.abs(), torch.tensor(1.0, device=device, dtype=dtype))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_adjoint(self, device, dtype, batch_size):s = So2.identity(batch_size, device=device, dtype=dtype)self.assert_close(s.matrix(), s.adjoint())diff --git a/tests/geometry/liegroup/test_so3.py b/tests/geometry/liegroup/test_so3.pyindex 5ff59d514..74f8c3f57 100644--- a/tests/geometry/liegroup/test_so3.py+++ b/tests/geometry/liegroup/test_so3.py@@ -278,7 +278,7 @@ class TestSo3(BaseTester):def test_module(self, device, dtype):pass- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_init(self, device, dtype, batch_size):q = Quaternion.identity(batch_size, device, dtype)s1 = So3(q)@@ -286,7 +286,7 @@ class TestSo3(BaseTester):assert isinstance(s2, So3)self.assert_close(s1.q.data, s2.q.data)- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_getitem(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)s = So3(q)@@ -294,7 +294,7 @@ class TestSo3(BaseTester):s1 = s[i]self.assert_close(s1.q.data, q.data[i])- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_mul(self, device, dtype, batch_size):q1 = Quaternion.identity(batch_size, device, dtype)q2 = Quaternion.random(batch_size, device, dtype)@@ -305,7 +305,7 @@ class TestSo3(BaseTester):self.assert_close((s2 * s2.inverse()).q.data, s1.q.data)self.assert_close((s1 * t), t)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_mul_vec(self, device, dtype, batch_size):q1 = Quaternion.identity(batch_size, device, dtype)q2 = Quaternion.random(batch_size, device, dtype)@@ -320,7 +320,7 @@ class TestSo3(BaseTester):self.assert_close((s2 * s2.inverse()).q.data, s1.q.data)self.assert_close((s1 * t), t)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_unit_norm(self, device, dtype, batch_size):q1 = Quaternion.random(batch_size, device, dtype)q2 = Quaternion.random(batch_size, device, dtype)@@ -344,21 +344,21 @@ class TestSo3(BaseTester):self.assert_close(s5[i].q.norm(), ones_vec)self.assert_close(s6[i].q.norm(), ones_vec)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_exp(self, device, dtype, batch_size):q = Quaternion.identity(batch_size, device, dtype)s = So3(q)zero_vec = 0 * self._make_rand_data(device, dtype, batch_size, dims=3)self.assert_close(s.exp(zero_vec).q.data, q.data) # exp of zero vec is identity- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_log(self, device, dtype, batch_size):q = Quaternion.identity(batch_size, device, dtype)s = So3(q)zero_vec = 0 * self._make_rand_data(device, dtype, batch_size, dims=3)self.assert_close(s.log(), zero_vec) # log of identity quat is zero vec- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_exp_log(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)s = So3(q)@@ -366,7 +366,7 @@ class TestSo3(BaseTester):b = s.exp(a).log()self.assert_close(b, a)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_hat(self, device, dtype, batch_size):v = torch.tensor([1, 2, 3], device=device, dtype=dtype)expected = v@@ -377,7 +377,7 @@ class TestSo3(BaseTester):hat = hat[None]self.assert_close(hat.unique()[-3:], expected)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_vee(self, device, dtype, batch_size):omega = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], device=device, dtype=dtype)expected = torch.tensor([8, 3, 4], device=device, dtype=dtype)@@ -386,14 +386,14 @@ class TestSo3(BaseTester):expected = expected.repeat(batch_size, 1)self.assert_close(So3.vee(omega), expected)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_hat_vee(self, device, dtype, batch_size):a = self._make_rand_data(device, dtype, batch_size, dims=3)omega = So3.hat(a)b = So3.vee(omega)self.assert_close(b, a)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_matrix(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)r = So3(q).matrix()@@ -410,7 +410,7 @@ class TestSo3(BaseTester):self.assert_close(rp_, qp_.vec) # p_ = R*p = q*p*q_invself.assert_close(rp_.norm(), pvec.norm())- @pytest.mark.parametrize("batch_size", (None, 1, 2))+ @pytest.mark.parametrize("batch_size", [None, 1, 2])def test_from_matrix_check_rotation(self, device, dtype, batch_size):# kornia#4773: from_matrix delegates to rotation_matrix_to_quaternion, so by default the# reflection diag(-1, 1, 1) becomes the identity instead of being rejected. So2.from_matrix@@ -426,7 +426,7 @@ class TestSo3(BaseTester):with pytest.raises(ValueError, match="reflection"):So3.from_matrix(reflection, check_rotation=True)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_from_matrix_check_rotation_accepts_rotation(self, device, dtype, batch_size):# A genuine rotation passes the check, and the flag does not alter the result. Comparing# the two calls rather than the matrix round trip keeps this about the check itself: the@@ -435,13 +435,13 @@ class TestSo3(BaseTester):matrix = So3(q).matrix()self.assert_close(So3.from_matrix(matrix, check_rotation=True).q.data, So3.from_matrix(matrix).q.data)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_from_wxyz(self, device, dtype, batch_size):wxyz = self._make_rand_data(device, dtype, batch_size, dims=4)s = So3.from_wxyz(wxyz)self.assert_close(s.q.data, wxyz)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_ortho(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)b_R_a = So3(q).matrix()@@ -464,34 +464,34 @@ class TestSo3(BaseTester):self.assert_close(a_R_b[i, :, :] @ b_R_a[i, :, :], eye_mat[i])self.assert_close(b_R_a[i, :, :] @ a_R_b[i, :, :], eye_mat[i])- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_inverse(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)self.assert_close(So3(q).inverse().inverse().q.data, q.data)self.assert_close(So3(q).inverse().inverse().matrix(), So3(q).matrix())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_rot_x(self, device, dtype, batch_size):x = self._make_rand_data(device, dtype, batch_size, dims=1).squeeze(-1)so3 = So3.rot_x(x)roll, _, _ = euler_from_quaternion(*so3.q.coeffs)self.assert_close(x, roll)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_rot_y(self, device, dtype, batch_size):y = self._make_rand_data(device, dtype, batch_size, dims=1).squeeze(-1)so3 = So3.rot_y(y)_, pitch, _ = euler_from_quaternion(*so3.q.coeffs)self.assert_close(y, pitch)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_rot_z(self, device, dtype, batch_size):z = self._make_rand_data(device, dtype, batch_size, dims=1).squeeze(-1)so3 = So3.rot_z(z)_, _, yaw = euler_from_quaternion(*so3.q.coeffs)self.assert_close(z, yaw)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_adjoint(self, device, dtype, batch_size):shape = (3,) if batch_size is None else (batch_size, 3)x = So3.exp(torch.tensor([0.1, -0.2, 0.3], device=device, dtype=dtype).expand(shape))@@ -503,14 +503,14 @@ class TestSo3(BaseTester):self.assert_close(adjoint @ inverse_adjoint, identity, rtol=half_tolerance, atol=half_tolerance)self.assert_close((x * y).adjoint(), adjoint @ y.adjoint(), rtol=half_tolerance, atol=half_tolerance)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_random(self, device, dtype, batch_size):s = So3.random(batch_size=batch_size, device=device, dtype=dtype)s_in_s = s.inverse() * si = So3.identity(batch_size=batch_size, device=device, dtype=dtype)self.assert_close(s_in_s.q.data, i.q.data)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_right_jacobian(self, device, dtype, batch_size):vec = self._make_rand_data(device, dtype, batch_size, dims=3)Jr = So3.right_jacobian(vec)@@ -518,7 +518,7 @@ class TestSo3(BaseTester):self.assert_close(vec[..., None], Jr @ vec[..., None])self.assert_close(Jr.transpose(-1, -2) @ Jr, I, atol=0.1, rtol=0.1)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_left_jacobian(self, device, dtype, batch_size):vec = self._make_rand_data(device, dtype, batch_size, dims=3)Jl = So3.left_jacobian(vec)@@ -526,7 +526,7 @@ class TestSo3(BaseTester):self.assert_close(vec[..., None], Jl @ vec[..., None])self.assert_close(Jl.transpose(-1, -2) @ Jl, I, atol=0.1, rtol=0.1)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_right_left_jacobian(self, device, dtype, batch_size):vec = self._make_rand_data(device, dtype, batch_size, dims=3)Jr = So3.right_jacobian(vec)diff --git a/tests/geometry/test_conversions.py b/tests/geometry/test_conversions.pyindex c6ad51e00..ce965e0ac 100644--- a/tests/geometry/test_conversions.py+++ b/tests/geometry/test_conversions.py@@ -540,7 +540,7 @@ class TestAngleAxisToQuaternion(BaseTester):quaternion = kornia.geometry.conversions.axis_angle_to_quaternion(axis_angle)assert quaternion.shape == (4,)- @pytest.mark.parametrize("batch_size", (1, 3, 8))+ @pytest.mark.parametrize("batch_size", [1, 3, 8])def test_smoke_batch(self, batch_size, device, dtype):axis_angle = torch.zeros(batch_size, 3, device=device, dtype=dtype)quaternion = kornia.geometry.conversions.axis_angle_to_quaternion(axis_angle)@@ -594,7 +594,7 @@ class TestAngleAxisToQuaternion(BaseTester):quaternion = kornia.geometry.conversions.axis_angle_to_quaternion(axis_angle)self.assert_close(quaternion, expected, atol=atol, rtol=rtol)- @pytest.mark.parametrize("input_dtype", (torch.int16, torch.int32, torch.int64, torch.uint8))+ @pytest.mark.parametrize("input_dtype", [torch.int16, torch.int32, torch.int64, torch.uint8])def test_convention_integer_input_is_promoted_to_float_3948(self, input_dtype, device):# Convention, and the answer kornia#3948 settled: an integer axis-angle is PROMOTED, not# rejected. The output buffer used to be allocated with dtype=axis_angle.dtype, so an@@ -621,7 +621,7 @@ class TestAngleAxisToQuaternion(BaseTester):expected = torch.tensor((np.cos(0.5), np.sin(0.5), 0.0, 0.0), device=device, dtype=quaternion.dtype)self.assert_close(quaternion, expected, atol=1.0e-4, rtol=1.0e-4)- @pytest.mark.parametrize("input_dtype", (torch.float16, torch.bfloat16, torch.float32, torch.float64))+ @pytest.mark.parametrize("input_dtype", [torch.float16, torch.bfloat16, torch.float32, torch.float64])def test_convention_float_input_keeps_its_dtype_3948(self, input_dtype, device):# The other side of the #3948 buffer change, and the regression it could have introduced:# taking the buffer dtype from the computed values must NOT widen a float input. float16@@ -910,7 +910,7 @@ class TestQuaternionToAngleAxis(BaseTester):axis_angle = kornia.geometry.conversions.quaternion_to_axis_angle(quaternion)assert axis_angle.shape == (3,)- @pytest.mark.parametrize("batch_size", (1, 3, 8))+ @pytest.mark.parametrize("batch_size", [1, 3, 8])def test_smoke_batch(self, batch_size, device, dtype):quaternion = torch.zeros(batch_size, 4, device=device, dtype=dtype)axis_angle = kornia.geometry.conversions.quaternion_to_axis_angle(quaternion)@@ -1040,7 +1040,7 @@ class TestQuaternionToAngleAxis(BaseTester):class TestRotationMatrixToQuaternion(BaseTester):- @pytest.mark.parametrize("batch_size", (1, 3, 8))+ @pytest.mark.parametrize("batch_size", [1, 3, 8])def test_smoke_batch(self, batch_size, device, dtype):matrix = torch.zeros(batch_size, 3, 3, device=device, dtype=dtype)quaternion = kornia.geometry.conversions.rotation_matrix_to_quaternion(matrix)@@ -1324,7 +1324,7 @@ class TestRotationMatrixToQuaternion(BaseTester):class TestQuaternionToRotationMatrix(BaseTester):- @pytest.mark.parametrize("batch_dims", ((), (1,), (3,), (8,), (1, 1), (5, 6)))+ @pytest.mark.parametrize("batch_dims", [(), (1,), (3,), (8,), (1, 1), (5, 6)])def test_smoke_batch(self, batch_dims, device, dtype):quaternion = torch.zeros(*batch_dims, 4, device=device, dtype=dtype)matrix = kornia.geometry.conversions.quaternion_to_rotation_matrix(quaternion)@@ -1638,7 +1638,7 @@ class TestQuaternionToRotationMatrix(BaseTester):class TestQuaternionLogToExp(BaseTester):- @pytest.mark.parametrize("batch_size", (1, 3, 8))+ @pytest.mark.parametrize("batch_size", [1, 3, 8])def test_smoke_batch(self, batch_size, device, dtype):quaternion_log = torch.zeros(batch_size, 3, device=device, dtype=dtype)quaternion_exp = kornia.geometry.conversions.quaternion_log_to_exp(quaternion_log)@@ -1791,7 +1791,7 @@ class TestQuaternionLogToExp(BaseTester):class TestQuaternionExpToLog(BaseTester):- @pytest.mark.parametrize("batch_size", (1, 3, 8))+ @pytest.mark.parametrize("batch_size", [1, 3, 8])def test_smoke_batch(self, batch_size, device, dtype):eps = torch.finfo(dtype).epsquaternion_exp = torch.zeros(batch_size, 4, device=device, dtype=dtype)@@ -2056,7 +2056,7 @@ class TestQuaternionExpToLog(BaseTester):class TestAngleAxisToRotationMatrix(BaseTester):- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_rand_axis_angle_gradcheck(self, batch_size, device, atol, rtol):dtype = torch.float64# generate input data@@ -2417,7 +2417,7 @@ class TestAngleAxisToRotationMatrix(BaseTester):class TestRotationMatrixToAngleAxis(BaseTester):- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_rand_quaternion_gradcheck(self, batch_size, device, dtype, atol, rtol):# generate input dataquaternion = torch.rand(batch_size, 4, device=device, dtype=dtype)@@ -5438,7 +5438,7 @@ class TestEulerFromQuaternion(BaseTester):assert roll.shape == pitch.shapeassert pitch.shape == yaw.shape- @pytest.mark.parametrize("batch_size", ((1, 3, 4)))+ @pytest.mark.parametrize("batch_size", ([1, 3, 4]))def test_cardinality(self, device, dtype, batch_size):q = Quaternion.random(batch_size=batch_size)q = q.to(device, dtype)@@ -5780,7 +5780,7 @@ class TestQuaternionFromEuler(BaseTester):assert qx.shape == qy.shapeassert qy.shape == qz.shape- @pytest.mark.parametrize("batch_size", ((1, 3, 4)))+ @pytest.mark.parametrize("batch_size", ([1, 3, 4]))def test_cardinality(self, device, dtype, batch_size):roll, pitch, yaw = torch.rand(3, batch_size, device=device, dtype=dtype)qw, qx, qy, qz = quaternion_from_euler(roll, pitch, yaw)@@ -5927,7 +5927,7 @@ class TestQuaternionFromEuler(BaseTester):assert (rot - rot_x @ rot_z @ rot_y).abs().max() > 0.2[email protected]("batch_size", (None, 1, 2, 5))[email protected]("batch_size", [None, 1, 2, 5])def test_vector_to_skew_symmetric_matrix(batch_size, device, dtype):if batch_size is None:vector = torch.rand(3, device=device, dtype=dtype)diff --git a/tests/geometry/test_depth_warper.py b/tests/geometry/test_depth_warper.pyindex c1c6b2396..a13ad4a45 100644--- a/tests/geometry/test_depth_warper.py+++ b/tests/geometry/test_depth_warper.py@@ -43,7 +43,7 @@ class TestDepthWarper(BaseTester):)return pinhole_src, pinhole_dst- @pytest.mark.parametrize("batch_size", (1, 2))+ @pytest.mark.parametrize("batch_size", [1, 2])def test_compute_projection_matrix(self, batch_size, device, dtype):height, width = 3, 5 # output shapepinhole_src, pinhole_dst = self._create_pinhole_pair(batch_size, device, dtype)@@ -65,7 +65,7 @@ class TestDepthWarper(BaseTester):dst_proj_src_expected[..., 0, -1] += 1.0 # offset to x-axisself.assert_close(dst_proj_src, dst_proj_src_expected)- @pytest.mark.parametrize("batch_size", (1, 2))+ @pytest.mark.parametrize("batch_size", [1, 2])def test_warp_grid_offset_x1_depth1(self, batch_size, device, dtype):height, width = 3, 5 # output shapepinhole_src, pinhole_dst = self._create_pinhole_pair(batch_size, device, dtype)@@ -90,7 +90,7 @@ class TestDepthWarper(BaseTester):# check that y-axis remain the sameself.assert_close(grid_warped[..., -1, 1], grid_norm[..., -1, 1].repeat(batch_size, 1), rtol=1e-4, atol=1e-4)- @pytest.mark.parametrize("batch_size", (1, 2))+ @pytest.mark.parametrize("batch_size", [1, 2])def test_warp_grid_offset_x1y1_depth1(self, batch_size, device, dtype):height, width = 3, 5 # output shapepinhole_src, pinhole_dst = self._create_pinhole_pair(batch_size, device, dtype)@@ -118,7 +118,7 @@ class TestDepthWarper(BaseTester):grid_warped[..., -2, :, 1], grid_norm[..., -1, :, 1].repeat(batch_size, 1), rtol=1e-4, atol=1e-4)- @pytest.mark.parametrize("batch_size", (1, 2))+ @pytest.mark.parametrize("batch_size", [1, 2])def test_warp_tensor_offset_x1y1(self, batch_size, device, dtype):channels, height, width = 3, 3, 5 # output shapepinhole_src, pinhole_dst = self._create_pinhole_pair(batch_size, device, dtype)@@ -145,7 +145,7 @@ class TestDepthWarper(BaseTester):# compare patchesself.assert_close(patch_dst[..., 1:, 1:], patch_src[..., :2, :4], atol=1e-4, rtol=1e-4)- @pytest.mark.parametrize("batch_size", (1, 2))+ @pytest.mark.parametrize("batch_size", [1, 2])def test_compute_projection(self, batch_size, device, dtype):height, width = 3, 5 # output shapepinhole_src, pinhole_dst = self._create_pinhole_pair(batch_size, device, dtype)@@ -158,7 +158,7 @@ class TestDepthWarper(BaseTester):xy_projected = warper._compute_projection(0.0, 0.0, 1.0)assert xy_projected.shape == (batch_size, 2)- @pytest.mark.parametrize("batch_size", (1, 2))+ @pytest.mark.parametrize("batch_size", [1, 2])def test_compute_subpixel_step(self, batch_size, device, dtype):height, width = 3, 5 # output shapepinhole_src, pinhole_dst = self._create_pinhole_pair(batch_size, device, dtype)@@ -171,7 +171,7 @@ class TestDepthWarper(BaseTester):subpixel_step = warper.compute_subpixel_step()self.assert_close(subpixel_step.item(), 0.1715, rtol=1e-3, atol=1e-3)- @pytest.mark.parametrize("batch_size", (1, 2))+ @pytest.mark.parametrize("batch_size", [1, 2])def test_gradcheck(self, batch_size, device):dtype = torch.float64# prepare datadiff --git a/tests/geometry/test_line.py b/tests/geometry/test_line.pyindex 4b5ad5e3b..2151f3bb7 100644--- a/tests/geometry/test_line.py+++ b/tests/geometry/test_line.py@@ -131,7 +131,7 @@ class TestParametrizedLine(BaseTester):point_projection = torch.tensor([1.0, 0.0], device=device, dtype=dtype)self.assert_close(l1.projection(point), point_projection)- @pytest.mark.parametrize("batch_size", (2, 3))+ @pytest.mark.parametrize("batch_size", [2, 3])def test_batched_projection(self, device, dtype, batch_size):origin = torch.tensor([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], device=device, dtype=dtype)[:batch_size]direction = torch.tensor([[1.0, 0.0], [1.0, 0.0], [1.0, 0.0]], device=device, dtype=dtype)[:batch_size]@@ -324,8 +324,8 @@ def _near_vertical_points_5040(device, dtype) -> torch.Tensor:class TestFitLine(BaseTester):- @pytest.mark.parametrize("B", (1, 2))- @pytest.mark.parametrize("D", (2, 3, 4))+ @pytest.mark.parametrize("B", [1, 2])+ @pytest.mark.parametrize("D", [2, 3, 4])def test_smoke(self, device, dtype, B, D):N: int = 10 # num points# A line needs distinct points: ones() is a set of identical points, rejected since #5041.@@ -719,7 +719,7 @@ class TestFitLine(BaseTester):assert torch.isfinite(line.direction).all()assert torch.isfinite(line.origin).all()- @pytest.mark.parametrize("dim", (2, 3))+ @pytest.mark.parametrize("dim", [2, 3])def test_gradcheck(self, device, dim):# Two point sets whose rows differ, each projected onto its own fitted line (#5013).def proxy_func(pts, weights):diff --git a/tests/geometry/test_plane.py b/tests/geometry/test_plane.pyindex 0d3197f2c..6a531f0cf 100644--- a/tests/geometry/test_plane.py+++ b/tests/geometry/test_plane.py@@ -28,8 +28,8 @@ from testing.base import BaseTester# TODO: implement the rest of methodsclass TestFitPlane(BaseTester):- @pytest.mark.parametrize("N", (4, 10))- @pytest.mark.parametrize("D", (3,))+ @pytest.mark.parametrize("N", [4, 10])+ @pytest.mark.parametrize("D", [3])# @pytest.mark.parametrize("D", (2, 3, 4))def test_smoke(self, device, dtype, N, D):# A plane needs non-collinear points: ones() is a set of identical points, rejected since #5041.@@ -94,7 +94,7 @@ class TestFitPlane(BaseTester):# TODO: implement the rest of methodsclass TestHyperplane(BaseTester):- @pytest.mark.parametrize("shape", (None, (1,), (2, 1)))+ @pytest.mark.parametrize("shape", [None, (1,), (2, 1)])def test_smoke(self, device, dtype, shape):p0 = Vector3.random(shape, device, dtype)n0 = Vector3.random(shape, device, dtype).normalized()@@ -114,7 +114,7 @@ class TestHyperplane(BaseTester):loaded_plane = torch.load(file_path, weights_only=False)self.assert_close(plane.normal.unwrap(), loaded_plane.normal.unwrap())- @pytest.mark.parametrize("shape", ((2,), (1, 2), (3,), (1, 3)))+ @pytest.mark.parametrize("shape", [(2,), (1, 2), (3,), (1, 3)])def test_through_two_points_raises(self, device, dtype, shape):# Hyperplane stores a Vector3 normal and has no 2D form: two points must be rejected with a# message that names the three-point requirement, whatever the points' dimension.@@ -123,7 +123,7 @@ class TestHyperplane(BaseTester):with pytest.raises(BaseError, match="requires three points"):Hyperplane.through(p0, p1)- @pytest.mark.parametrize("shape", (None, (1,), (2, 1)))+ @pytest.mark.parametrize("shape", [None, (1,), (2, 1)])def test_through_three(self, device, dtype, shape):v0 = Vector3.random(shape, device, dtype)v1 = Vector3.random(shape, device, dtype)@@ -183,7 +183,7 @@ class TestHyperplane(BaseTester):with pytest.raises(ValueCheckError, match="not collinear"):Hyperplane.through(torch.stack([p0, a]), torch.stack([p1, b]), torch.stack([p2, c]))- @pytest.mark.parametrize("scale", (1.0, 1e-4))+ @pytest.mark.parametrize("scale", [1.0, 1e-4])def test_through_small_valid_triangle_keeps_orientation_5064(self, device, dtype, scale):# A small triangle is not collinear, and it keeps the (p2 - p0) x (p1 - p0) orientation. In float16 the# cross product of the 1e-4 triangle underflows to 0 (1e-8 is below the smallest subnormal), so it took the@@ -194,7 +194,7 @@ class TestHyperplane(BaseTester):plane = Hyperplane.through(p0, p1, p2)self.assert_close(plane.normal.unwrap(), torch.tensor([0.0, 0.0, -1.0], device=device, dtype=dtype))- @pytest.mark.parametrize("size", (300.0, 4e4))+ @pytest.mark.parametrize("size", [300.0, 4e4])def test_through_large_triangle_keeps_orientation_5064(self, device, dtype, size):# The normal is (p2 - p0) x (p1 - p0) = (size, size, 0) x (2 size, 0, 0) = (0, 0, -2 size^2). In float16 that# overflows for size 300 (-1.8e5 is beyond 65504), and for size 4e4 the edge p1 - p0 = 8e4 overflows too: the@@ -265,7 +265,7 @@ class TestHyperplane(BaseTester):self.assert_close(Hyperplane.through(points[0], points[1], points[2]).normal.unwrap().abs(), expected)self.assert_close(fit_plane(points).normal.unwrap().abs(), expected)- @pytest.mark.parametrize("shape", (None, (1,), (2, 1)))+ @pytest.mark.parametrize("shape", [None, (1,), (2, 1)])def test_abs_signed_distance(self, device, dtype, shape):p0 = Vector3.random(shape, device, dtype)p1 = Vector3.random(shape, device, dtype)diff --git a/tests/geometry/test_pose.py b/tests/geometry/test_pose.pyindex 74d2ba7b7..bf7ce39ef 100644--- a/tests/geometry/test_pose.py+++ b/tests/geometry/test_pose.py@@ -177,7 +177,7 @@ class TestNamedPose(BaseTester):assert a_from_b.frame_src == "frame_b"assert a_from_b.frame_dst == "frame_a"- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_transform_points(self, device, dtype, batch_size):if batch_size is None:points_in_a = torch.randn(3, device=device, dtype=dtype)diff --git a/tests/geometry/test_quaternion.py b/tests/geometry/test_quaternion.pyindex 1ea8e8339..f2087042d 100644--- a/tests/geometry/test_quaternion.py+++ b/tests/geometry/test_quaternion.py@@ -44,7 +44,7 @@ class TestQuaternion(BaseTester):self.assert_close(q.scalar, q_data[..., 0])self.assert_close(q.vec, q_data[..., 1:])- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_init(self, device, dtype, batch_size):q1 = Quaternion.identity(batch_size, device, dtype)q2 = Quaternion(q1.data)@@ -74,20 +74,20 @@ class TestQuaternion(BaseTester):q = Quaternion(data)self.assert_close(q.data, data)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_random(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)q_n = q.normalize().norm()self.assert_close(q_n, q_n.new_ones(q_n.shape))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_minus(self, device, dtype, batch_size):data = self._make_rand_data(device, dtype, batch_size)q = Quaternion(data)q = q.to(device, dtype)self.assert_close(-q, -data)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_add(self, device, dtype, batch_size):d1 = self._make_rand_data(device, dtype, batch_size)d2 = self._make_rand_data(device, dtype, batch_size)@@ -99,7 +99,7 @@ class TestQuaternion(BaseTester):q1 += q2self.assert_close(q1, q3)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_subtract(self, device, dtype, batch_size):d1 = self._make_rand_data(device, dtype, batch_size)d2 = self._make_rand_data(device, dtype, batch_size)@@ -155,7 +155,7 @@ class TestQuaternion(BaseTester):self.assert_close(k / k, one)self.assert_close(i / -j, k)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_pow(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)q1 = Quaternion.identity(batch_size, device, dtype)@@ -234,7 +234,7 @@ class TestQuaternion(BaseTester):(q**t).data[0, 1].backward()self.assert_close(t.grad, torch.tensor(2.0**0.5 * math.log(2.0), device=device, dtype=dtype))- @pytest.mark.parametrize("t", (-1.0, 0.5, 2.0))+ @pytest.mark.parametrize("t", [-1.0, 0.5, 2.0])def test_pow_gradcheck(self, device, t):# the first quaternion lies on the real axis, where the vector part has zero norm; the last is pure imaginary# (w = 0), where the unselected real-axis arm divides by w@@ -243,7 +243,7 @@ class TestQuaternion(BaseTester):)self.gradcheck(lambda x: (Quaternion(x) ** t).data, (data,))- @pytest.mark.parametrize("t", (-1.0, 2.0, 3.0))+ @pytest.mark.parametrize("t", [-1.0, 2.0, 3.0])def test_pow_gradcheck_negative_real_axis(self, device, t):# q = -2 has theta = pi, where the real-axis limit t * cos(t * theta) / w carries the signs of cos(t * pi) and# of w. Only integer t: for a non-integer t the negative real axis is a branch cut with no derivative.@@ -297,7 +297,7 @@ class TestQuaternion(BaseTester):)self.gradcheck(lambda x: Quaternion(x).polar_angle, (data,))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_quaternion_scalar_multiplication(self, device, dtype, batch_size):"""Test scalar multiplication for issue #3101."""# Create a quaternion with parameters to test gradient flow@@ -317,42 +317,42 @@ class TestQuaternion(BaseTester):# The quaternion's parameter should have gradientsassert q.data.grad is not None- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_inverse(self, device, dtype, batch_size):q1 = Quaternion.random(batch_size, device, dtype)q2 = Quaternion.identity(batch_size, device, dtype)self.assert_close(q1 * q1.inv(), q2, rtol=1e-4, atol=1e-4)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_conjugate(self, device, dtype, batch_size):q1 = Quaternion.random(batch_size, device, dtype)q2 = Quaternion.random(batch_size, device, dtype)self.assert_close((q1 * q2).conj(), q2.conj() * q1.conj())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_double_conjugate(self, device, dtype, batch_size):q1 = Quaternion.random(batch_size, device, dtype)self.assert_close(q1, q1.conj().conj())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_norm(self, device, dtype, batch_size):q1 = Quaternion.random(batch_size, device, dtype)q2 = Quaternion.random(batch_size, device, dtype)self.assert_close((q1 * q2).norm(), q1.norm() * q2.norm())- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_norm_shape(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)expected_shape = () if batch_size is None else (batch_size,)self.assert_close(tuple(q.norm().shape), expected_shape)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_normalize(self, device, dtype, batch_size):q1 = Quaternion.random(batch_size, device, dtype)q1_n = q1.normalize().norm()self.assert_close(q1_n, q1_n.new_ones(q1_n.shape))- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_matrix(self, device, dtype, batch_size):q1 = Quaternion.random(batch_size, device, dtype)m1 = q1.matrix()@@ -363,7 +363,7 @@ class TestQuaternion(BaseTester):except Exception:self.assert_close(qq1, -qq2)- @pytest.mark.parametrize("batch_size", (1, 2))+ @pytest.mark.parametrize("batch_size", [1, 2])def test_from_matrix_check_rotation(self, device, dtype, batch_size):# kornia#4773: the reflection diag(-1, 1, 1) is orthogonal but has det = -1, and by default# comes back as the non-unit quaternion [0.7071, 0, 0, 0] rather than being rejected.@@ -380,14 +380,14 @@ class TestQuaternion(BaseTester):Quaternion.from_matrix(rotation).data,)- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_getitem(self, device, dtype, batch_size):q = Quaternion.random(batch_size, device, dtype)for i in range(batch_size):q1 = q[i]self.assert_close(q1.data, q.data[i])- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_axis_angle(self, device, dtype, batch_size):q1 = Quaternion.random(batch_size, device, dtype)angle = 2 * q1.scalar.arccos()[..., None]@@ -397,7 +397,7 @@ class TestQuaternion(BaseTester):q2 = q2.to(device, dtype)self.assert_close(q1, q2)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_to_axis_angle(self, device, dtype, batch_size):# batch_s = 5# random_coefs = Quaternion.random(batch_s).data@@ -430,7 +430,7 @@ class TestQuaternion(BaseTester):self.assert_close(axis_angle_expected, axis_angle_actual, 1e-4, 1e-4)- @pytest.mark.parametrize("batch_size", (None, 1, 2, 5))+ @pytest.mark.parametrize("batch_size", [None, 1, 2, 5])def test_slerp(self, device, dtype, batch_size):for axis in torch.tensor([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]):axis = axis.to(device, dtype)diff --git a/tests/geometry/test_vector.py b/tests/geometry/test_vector.pyindex d9acbbfa3..b512b2bed 100644--- a/tests/geometry/test_vector.py+++ b/tests/geometry/test_vector.py@@ -35,7 +35,7 @@ class TestVector3(BaseTester):assert vec.y is not Noneassert vec.z is not None- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_getitem(self, device, dtype, batch_size):xyz = torch.rand((batch_size, 3), device=device, dtype=dtype)vec = Vector3(xyz)@@ -43,7 +43,7 @@ class TestVector3(BaseTester):v = vec[i]self.assert_close(v.data, xyz[i, ...])- @pytest.mark.parametrize("shape", ((), (1,), (2, 4)))+ @pytest.mark.parametrize("shape", [(), (1,), (2, 4)])def test_cardinality(self, device, dtype, shape):vec = Vector3.random(shape, device, dtype)assert vec.shape[:-1] == shape@@ -58,7 +58,7 @@ class TestVector3(BaseTester):assert vec.y == 1.0assert vec.z == 0.0- @pytest.mark.parametrize("shape", ((), (1,), (2, 4)))+ @pytest.mark.parametrize("shape", [(), (1,), (2, 4)])def test_from_coords_tensor(self, device, dtype, shape):xyz = torch.rand((*shape, 3), device=device, dtype=dtype)vec = Vector3.from_coords(xyz[..., 0], xyz[..., 1], xyz[..., 2])@@ -67,7 +67,7 @@ class TestVector3(BaseTester):assert vec.y.shape == shapeassert vec.z.shape == shape- @pytest.mark.parametrize("shape", (None, (1,), (2, 1)))+ @pytest.mark.parametrize("shape", [None, (1,), (2, 1)])def test_dot(self, device, dtype, shape):p0 = Vector3.random(shape, device, dtype)n0 = Vector3.random(shape, device, dtype).normalized()@@ -76,7 +76,7 @@ class TestVector3(BaseTester):expected = torch.ones(shape or (), device=device, dtype=dtype)self.assert_close(n0.dot(n0), expected)- @pytest.mark.parametrize("shape", (None, (1,), (2, 1)))+ @pytest.mark.parametrize("shape", [None, (1,), (2, 1)])def test_squared_norm(self, device, dtype, shape):p0 = Vector3.random(shape, device, dtype)res: Scalar = p0.squared_norm()@@ -143,7 +143,7 @@ class TestVector2(BaseTester):assert vec.x is not Noneassert vec.y is not None- @pytest.mark.parametrize("batch_size", (1, 2, 5))+ @pytest.mark.parametrize("batch_size", [1, 2, 5])def test_getitem(self, device, dtype, batch_size):xy = torch.rand((batch_size, 2), device=device, dtype=dtype)vec = Vector2(xy)@@ -151,7 +151,7 @@ class TestVector2(BaseTester):v = vec[i]self.assert_close(v.data, xy[i, ...])- @pytest.mark.parametrize("shape", ((), (1,), (2, 4)))+ @pytest.mark.parametrize("shape", [(), (1,), (2, 4)])def test_cardinality(self, device, dtype, shape):vec = Vector2.random(shape, device, dtype)assert vec.shape[:-1] == shape@@ -164,7 +164,7 @@ class TestVector2(BaseTester):assert vec.x == 0.0assert vec.y == 1.0- @pytest.mark.parametrize("shape", ((), (1,), (2, 4)))+ @pytest.mark.parametrize("shape", [(), (1,), (2, 4)])def test_from_coords_tensor(self, device, dtype, shape):xy = torch.rand((*shape, 2), device=device, dtype=dtype)vec = Vector2.from_coords(xy[..., 0], xy[..., 1])@@ -172,7 +172,7 @@ class TestVector2(BaseTester):assert vec.x.shape == shapeassert vec.y.shape == shape- @pytest.mark.parametrize("shape", (None, (1,), (2, 1)))+ @pytest.mark.parametrize("shape", [None, (1,), (2, 1)])def test_dot(self, device, dtype, shape):p0 = Vector2.random(shape, device, dtype)n0 = Vector2.random(shape, device, dtype).normalized()@@ -181,7 +181,7 @@ class TestVector2(BaseTester):expected = torch.ones(shape or (), device=device, dtype=dtype)self.assert_close(n0.dot(n0), expected)- @pytest.mark.parametrize("shape", (None, (1,), (2, 1)))+ @pytest.mark.parametrize("shape", [None, (1,), (2, 1)])def test_squared_norm(self, device, dtype, shape):p0 = Vector2.random(shape, device, dtype)res: Scalar = p0.squared_norm()diff --git a/tests/geometry/transform/test_elastic_transform.py b/tests/geometry/transform/test_elastic_transform.pyindex a17559367..99a62442c 100644--- a/tests/geometry/transform/test_elastic_transform.py+++ b/tests/geometry/transform/test_elastic_transform.py@@ -79,9 +79,9 @@ class TestElasticTransform(BaseTester):@pytest.mark.parametrize("kernel_size, sigma, alpha",[- [(3, 3), (4.0, 4.0), (32.0, 32.0)],- [(5, 3), (4.0, 8.0), (16.0, 32.0)],- [(5, 5), torch.tensor([2.0, 8.0]), torch.tensor([16.0, 64.0])],+ ((3, 3), (4.0, 4.0), (32.0, 32.0)),+ ((5, 3), (4.0, 8.0), (16.0, 32.0)),+ ((5, 5), torch.tensor([2.0, 8.0]), torch.tensor([16.0, 64.0])),],)def test_valid_paramters(self, device, dtype, kernel_size, sigma, alpha):diff --git a/tests/geometry/transform/test_imgwarp.py b/tests/geometry/transform/test_imgwarp.pyindex 983ac28b6..65ea73fd7 100644--- a/tests/geometry/transform/test_imgwarp.py+++ b/tests/geometry/transform/test_imgwarp.py@@ -498,8 +498,8 @@ class TestWarpAffine(BaseTester):traced = torch.jit.trace(SingletonWarp(), (src, affine), check_trace=False)self.assert_close(traced(src, affine), expected)- @pytest.mark.parametrize("batch_shape", ([1, 3, 2, 5], [2, 4, 3, 4], [3, 5, 6, 2]))- @pytest.mark.parametrize("out_shape", ([2, 5], [3, 4], [6, 2]))+ @pytest.mark.parametrize("batch_shape", [[1, 3, 2, 5], [2, 4, 3, 4], [3, 5, 6, 2]])+ @pytest.mark.parametrize("out_shape", [[2, 5], [3, 4], [6, 2]])def test_cardinality(self, device, dtype, batch_shape, out_shape):batch_size, channels, height, width = batch_shapeh_out, w_out = out_shape@@ -632,8 +632,8 @@ class TestWarpAffine(BaseTester):self.assert_close(img_a[:, :, :1, :1].squeeze(), fill_value.squeeze())- @pytest.mark.parametrize("align_corners", (True, False))- @pytest.mark.parametrize("padding_mode", ("zeros", "fill"))+ @pytest.mark.parametrize("align_corners", [True, False])+ @pytest.mark.parametrize("padding_mode", ["zeros", "fill"])def test_jit_script(self, device, dtype, align_corners, padding_mode):offset = 1.0h, w = 3, 4@@ -656,8 +656,8 @@ class TestWarpPerspective(BaseTester):img_a = kornia.geometry.warp_perspective(img_b, H_ab, (height, width))self.assert_close(img_b, img_a)- @pytest.mark.parametrize("batch_shape", ([1, 3, 2, 5], [2, 4, 3, 4], [3, 5, 6, 2]))- @pytest.mark.parametrize("out_shape", ([2, 5], [3, 4], [6, 2]))+ @pytest.mark.parametrize("batch_shape", [[1, 3, 2, 5], [2, 4, 3, 4], [3, 5, 6, 2]])+ @pytest.mark.parametrize("out_shape", [[2, 5], [3, 4], [6, 2]])def test_cardinality(self, device, dtype, batch_shape, out_shape):batch_size, channels, height, width = batch_shapeh_out, w_out = out_shapediff --git a/tests/geometry/transform/test_pyramid.py b/tests/geometry/transform/test_pyramid.pyindex 754980878..527f03ac8 100644--- a/tests/geometry/transform/test_pyramid.py+++ b/tests/geometry/transform/test_pyramid.py@@ -171,9 +171,9 @@ class TestBuildPyramid(BaseTester):assert len(pyramid) == 1assert pyramid[0].shape == (1, 2, 4, 5)- @pytest.mark.parametrize("batch_size", (1, 2, 3))- @pytest.mark.parametrize("channels", (1, 3))- @pytest.mark.parametrize("max_level", (2, 3, 4))+ @pytest.mark.parametrize("batch_size", [1, 2, 3])+ @pytest.mark.parametrize("channels", [1, 3])+ @pytest.mark.parametrize("max_level", [2, 3, 4])def test_num_levels(self, batch_size, channels, max_level, device, dtype):height, width = 16, 20sample = torch.rand(batch_size, channels, height, width, device=device, dtype=dtype)@@ -199,7 +199,7 @@ class TestBuildLaplacianPyramid(BaseTester):assert len(pyramid) == 1assert pyramid[0].shape == (1, 2, 4, 5)- @pytest.mark.parametrize("height,width", ((5, 8), (8, 5)))+ @pytest.mark.parametrize("height,width", [(5, 8), (8, 5)])def test_mixed_power_of_two_size_padding(self, height, width, device, dtype):sample = torch.rand(1, 2, height, width, device=device, dtype=dtype)pyramid = kornia.geometry.transform.build_laplacian_pyramid(sample, max_level=2)@@ -207,22 +207,22 @@ class TestBuildLaplacianPyramid(BaseTester):@pytest.mark.parametrize("height,width,max_level,level_sizes",- (+ [(8, 6, 2, ((8, 6), (4, 3))),(12, 8, 2, ((12, 8), (6, 4))),(8, 12, 3, ((8, 12), (4, 6), (2, 3))),(20, 64, 3, ((20, 64), (10, 32), (5, 16))),(20, 64, 4, ((32, 64), (16, 32), (8, 16), (4, 8))),- ),+ ],)def test_padding_only_when_required_by_level_alignment(self, height, width, max_level, level_sizes, device, dtype):sample = torch.rand(1, 2, height, width, device=device, dtype=dtype)pyramid = kornia.geometry.transform.build_laplacian_pyramid(sample, max_level)assert [img.shape[-2:] for img in pyramid] == list(level_sizes)- @pytest.mark.parametrize("batch_size", (1, 2, 3))- @pytest.mark.parametrize("channels", (1, 3))- @pytest.mark.parametrize("max_level", (2, 3, 4))+ @pytest.mark.parametrize("batch_size", [1, 2, 3])+ @pytest.mark.parametrize("channels", [1, 3])+ @pytest.mark.parametrize("max_level", [2, 3, 4])def test_num_levels(self, batch_size, channels, max_level, device, dtype):height, width = 16, 32sample = torch.rand(batch_size, channels, height, width, device=device, dtype=dtype)