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

Method forward

gsplat/compression_simulation/quantizer.py:82–87  ·  view source on GitHub ↗
(ctx, input: Tensor, lower: float, upper: float, bitwidth: int)

Source from the content-addressed store, hash-verified

80class _RoundSTE(torch.autograd.Function):
81 @staticmethod
82 def forward(ctx, input: Tensor, lower: float, upper: float, bitwidth: int) -> Tensor:
83 clamped = input.clamp(lower, upper)
84 denom = (2 ** bitwidth) - 1
85 q_step = (upper - lower) / denom
86 levels = torch.round((clamped - lower) / q_step)
87 return levels * q_step + lower
88
89 @staticmethod
90 def backward(ctx, grad_output: Tensor) -> Tuple[Tensor, None, None, None]:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected