Example #1
0
    def test_scale_double(self, device, dtype):
        scale_factor = torch.tensor(0.5)
        camera_matrix = torch.tensor(
            [[[100.0, 0.0, 50.0], [0.0, 100.0, 50.0], [0.0, 0.0, 1.0]]],
            device=device,
            dtype=dtype)

        camera_matrix_expected = torch.tensor(
            [[[50.0, 0.0, 25.0], [0.0, 50.0, 25.0], [0.0, 0.0, 1.0]]],
            device=device,
            dtype=dtype)

        camera_matrix_scale = epi.scale_intrinsics(camera_matrix, scale_factor)
        assert_allclose(camera_matrix_scale,
                        camera_matrix_expected,
                        atol=1e-4,
                        rtol=1e-4)
Example #2
0
 def test_shape(self, batch_size, device, dtype):
     B: int = batch_size
     scale_factor = torch.rand(B, device=device, dtype=dtype)
     camera_matrix = torch.rand(B, 3, 3, device=device, dtype=dtype)
     camera_matrix_scale = epi.scale_intrinsics(camera_matrix, scale_factor)
     assert camera_matrix_scale.shape == (B, 3, 3)
Example #3
0
 def test_smoke_tensor(self, device, dtype):
     scale_factor = torch.tensor(1.0)
     camera_matrix = torch.rand(1, 3, 3, device=device, dtype=dtype)
     camera_matrix_scale = epi.scale_intrinsics(camera_matrix, scale_factor)
     assert camera_matrix_scale.shape == (1, 3, 3)