(
test_data,
fused: bool,
calc_compensations: bool,
camera_model: Literal["pinhole", "ortho", "fisheye"],
)
| 178 | @pytest.mark.parametrize("fused", [False, True]) |
| 179 | @pytest.mark.parametrize("calc_compensations", [True, False]) |
| 180 | def test_projection( |
| 181 | test_data, |
| 182 | fused: bool, |
| 183 | calc_compensations: bool, |
| 184 | camera_model: Literal["pinhole", "ortho", "fisheye"], |
| 185 | ): |
| 186 | from gsplat.cuda._torch_impl import _fully_fused_projection |
| 187 | from gsplat.cuda._wrapper import fully_fused_projection, quat_scale_to_covar_preci |
| 188 | |
| 189 | torch.manual_seed(42) |
| 190 | |
| 191 | Ks = test_data["Ks"] |
| 192 | viewmats = test_data["viewmats"] |
| 193 | height = test_data["height"] |
| 194 | width = test_data["width"] |
| 195 | quats = test_data["quats"] |
| 196 | scales = test_data["scales"] |
| 197 | means = test_data["means"] |
| 198 | |
| 199 | viewmats.requires_grad = True |
| 200 | quats.requires_grad = True |
| 201 | scales.requires_grad = True |
| 202 | means.requires_grad = True |
| 203 | |
| 204 | # forward |
| 205 | if fused: |
| 206 | radii, means2d, depths, conics, compensations = fully_fused_projection( |
| 207 | means, |
| 208 | None, |
| 209 | quats, |
| 210 | scales, |
| 211 | viewmats, |
| 212 | Ks, |
| 213 | width, |
| 214 | height, |
| 215 | calc_compensations=calc_compensations, |
| 216 | camera_model=camera_model, |
| 217 | ) |
| 218 | else: |
| 219 | covars, _ = quat_scale_to_covar_preci(quats, scales, triu=True) # [N, 6] |
| 220 | radii, means2d, depths, conics, compensations = fully_fused_projection( |
| 221 | means, |
| 222 | covars, |
| 223 | None, |
| 224 | None, |
| 225 | viewmats, |
| 226 | Ks, |
| 227 | width, |
| 228 | height, |
| 229 | calc_compensations=calc_compensations, |
| 230 | camera_model=camera_model, |
| 231 | ) |
| 232 | _covars, _ = quat_scale_to_covar_preci(quats, scales, triu=False) # [N, 3, 3] |
| 233 | _radii, _means2d, _depths, _conics, _compensations = _fully_fused_projection( |
| 234 | means, |
| 235 | _covars, |
| 236 | viewmats, |
| 237 | Ks, |
nothing calls this directly
no test coverage detected