(
ctx,
means: Tensor, # [N, 3]
covars: Tensor, # [N, 6] or None
quats: Tensor, # [N, 4] or None
scales: Tensor, # [N, 3] or None
viewmats: Tensor, # [C, 4, 4]
Ks: Tensor, # [C, 3, 3]
width: int,
height: int,
eps2d: float,
near_plane: float,
far_plane: float,
radius_clip: float,
calc_compensations: bool,
camera_model: Literal["pinhole", "ortho", "fisheye"] = "pinhole",
)
| 777 | |
| 778 | @staticmethod |
| 779 | def forward( |
| 780 | ctx, |
| 781 | means: Tensor, # [N, 3] |
| 782 | covars: Tensor, # [N, 6] or None |
| 783 | quats: Tensor, # [N, 4] or None |
| 784 | scales: Tensor, # [N, 3] or None |
| 785 | viewmats: Tensor, # [C, 4, 4] |
| 786 | Ks: Tensor, # [C, 3, 3] |
| 787 | width: int, |
| 788 | height: int, |
| 789 | eps2d: float, |
| 790 | near_plane: float, |
| 791 | far_plane: float, |
| 792 | radius_clip: float, |
| 793 | calc_compensations: bool, |
| 794 | camera_model: Literal["pinhole", "ortho", "fisheye"] = "pinhole", |
| 795 | ) -> Tuple[Tensor, Tensor, Tensor, Tensor, Tensor]: |
| 796 | camera_model_type = _make_lazy_cuda_obj( |
| 797 | f"CameraModelType.{camera_model.upper()}" |
| 798 | ) |
| 799 | |
| 800 | # "covars" and {"quats", "scales"} are mutually exclusive |
| 801 | radii, means2d, depths, conics, compensations = _make_lazy_cuda_func( |
| 802 | "fully_fused_projection_fwd" |
| 803 | )( |
| 804 | means, |
| 805 | covars, |
| 806 | quats, |
| 807 | scales, |
| 808 | viewmats, |
| 809 | Ks, |
| 810 | width, |
| 811 | height, |
| 812 | eps2d, |
| 813 | near_plane, |
| 814 | far_plane, |
| 815 | radius_clip, |
| 816 | calc_compensations, |
| 817 | camera_model_type, |
| 818 | ) |
| 819 | if not calc_compensations: |
| 820 | compensations = None |
| 821 | ctx.save_for_backward( |
| 822 | means, covars, quats, scales, viewmats, Ks, radii, conics, compensations |
| 823 | ) |
| 824 | ctx.width = width |
| 825 | ctx.height = height |
| 826 | ctx.eps2d = eps2d |
| 827 | ctx.camera_model_type = camera_model_type |
| 828 | |
| 829 | return radii, means2d, depths, conics, compensations |
| 830 | |
| 831 | @staticmethod |
| 832 | def backward(ctx, v_radii, v_means2d, v_depths, v_conics, v_compensations): |
nothing calls this directly
no test coverage detected