(
ctx,
means2d: Tensor, # [C, N, 2]
conics: Tensor, # [C, N, 3]
colors: Tensor, # [C, N, D]
opacities: Tensor, # [C, N]
backgrounds: Tensor, # [C, D], Optional
masks: Tensor, # [C, tile_height, tile_width], Optional
width: int,
height: int,
tile_size: int,
isect_offsets: Tensor, # [C, tile_height, tile_width]
flatten_ids: Tensor, # [n_isects]
absgrad: bool,
)
| 903 | |
| 904 | @staticmethod |
| 905 | def forward( |
| 906 | ctx, |
| 907 | means2d: Tensor, # [C, N, 2] |
| 908 | conics: Tensor, # [C, N, 3] |
| 909 | colors: Tensor, # [C, N, D] |
| 910 | opacities: Tensor, # [C, N] |
| 911 | backgrounds: Tensor, # [C, D], Optional |
| 912 | masks: Tensor, # [C, tile_height, tile_width], Optional |
| 913 | width: int, |
| 914 | height: int, |
| 915 | tile_size: int, |
| 916 | isect_offsets: Tensor, # [C, tile_height, tile_width] |
| 917 | flatten_ids: Tensor, # [n_isects] |
| 918 | absgrad: bool, |
| 919 | ) -> Tuple[Tensor, Tensor]: |
| 920 | render_colors, render_alphas, last_ids = _make_lazy_cuda_func( |
| 921 | "rasterize_to_pixels_fwd" |
| 922 | )( |
| 923 | means2d, |
| 924 | conics, |
| 925 | colors, |
| 926 | opacities, |
| 927 | backgrounds, |
| 928 | masks, |
| 929 | width, |
| 930 | height, |
| 931 | tile_size, |
| 932 | isect_offsets, |
| 933 | flatten_ids, |
| 934 | ) |
| 935 | |
| 936 | ctx.save_for_backward( |
| 937 | means2d, |
| 938 | conics, |
| 939 | colors, |
| 940 | opacities, |
| 941 | backgrounds, |
| 942 | masks, |
| 943 | isect_offsets, |
| 944 | flatten_ids, |
| 945 | render_alphas, |
| 946 | last_ids, |
| 947 | ) |
| 948 | ctx.width = width |
| 949 | ctx.height = height |
| 950 | ctx.tile_size = tile_size |
| 951 | ctx.absgrad = absgrad |
| 952 | |
| 953 | # double to float |
| 954 | render_alphas = render_alphas.float() |
| 955 | return render_colors, render_alphas |
| 956 | |
| 957 | @staticmethod |
| 958 | def backward( |
nothing calls this directly
no test coverage detected