def test_cases_1_and_4(self, device, lastdim): device = default_to_cpu_if_no_gpu(device) cam_coords = torch.rand(10, lastdim, device=device) proj_mat = torch.rand(4, 4, device=device) pixel_coords = gs.project_points(cam_coords, proj_mat) assert pixel_coords.shape == (10, 2)
def test_value_error_batchsize_2(self, device): device = default_to_cpu_if_no_gpu(device) cam_coords = torch.rand(2, 10, 3, device=device) proj_mat = torch.rand(1, 4, 4, device=device) with pytest.raises(ValueError): gs.project_points(cam_coords, proj_mat)
def test_type_error_proj_mat(self, device, lastdim): device = default_to_cpu_if_no_gpu(device) cam_coords = torch.rand(2, 10, lastdim, device=device) proj_mat = [1, 2, 3] with pytest.raises(TypeError): gs.project_points(cam_coords, proj_mat)
def test_value_error_proj_mat_2(self, device, dims): device = default_to_cpu_if_no_gpu(device) cam_coords = torch.rand(2, 2, device=device) proj_mat = torch.rand(dims[0], dims[1], device=device) with pytest.raises(ValueError): gs.project_points(cam_coords, proj_mat)
def test_type_error_cam_coords(self): cam_coords = [1, 2, 3] proj_mat = [1, 2, 3] with pytest.raises(TypeError): gs.project_points(cam_coords, proj_mat)