MCPcopy Create free account
hub / github.com/JasonLSC/GSCodec_Studio / backward

Method backward

gsplat/cuda/_wrapper.py:958–1028  ·  view source on GitHub ↗
(
        ctx,
        v_render_colors: Tensor,  # [C, H, W, 3]
        v_render_alphas: Tensor,  # [C, H, W, 1]
    )

Source from the content-addressed store, hash-verified

956
957 @staticmethod
958 def backward(
959 ctx,
960 v_render_colors: Tensor, # [C, H, W, 3]
961 v_render_alphas: Tensor, # [C, H, W, 1]
962 ):
963 (
964 means2d,
965 conics,
966 colors,
967 opacities,
968 backgrounds,
969 masks,
970 isect_offsets,
971 flatten_ids,
972 render_alphas,
973 last_ids,
974 ) = ctx.saved_tensors
975 width = ctx.width
976 height = ctx.height
977 tile_size = ctx.tile_size
978 absgrad = ctx.absgrad
979
980 (
981 v_means2d_abs,
982 v_means2d,
983 v_conics,
984 v_colors,
985 v_opacities,
986 ) = _make_lazy_cuda_func("rasterize_to_pixels_bwd")(
987 means2d,
988 conics,
989 colors,
990 opacities,
991 backgrounds,
992 masks,
993 width,
994 height,
995 tile_size,
996 isect_offsets,
997 flatten_ids,
998 render_alphas,
999 last_ids,
1000 v_render_colors.contiguous(),
1001 v_render_alphas.contiguous(),
1002 absgrad,
1003 )
1004
1005 if absgrad:
1006 means2d.absgrad = v_means2d_abs
1007
1008 if ctx.needs_input_grad[4]:
1009 v_backgrounds = (v_render_colors * (1.0 - render_alphas).float()).sum(
1010 dim=(1, 2)
1011 )
1012 else:
1013 v_backgrounds = None
1014
1015 return (

Callers

nothing calls this directly

Calls 1

_make_lazy_cuda_funcFunction · 0.85

Tested by

no test coverage detected