in quant/binary/weight_quantization.py [0:0]
def forward(self, w: torch.Tensor, skip: int = 3) -> torch.Tensor: # type: ignore
"""Forward pass of quantizing weight using least squares 2 bits."""
if self.training:
v1, v2, w_q = quantization.quantizer_ls_2(w, skip=skip)
self.v1.copy_(v1) # type: ignore
self.v2.copy_(v2) # type: ignore
else:
_, _, w_q = quantization.quantizer_ls_2(w, self.v1, self.v2, skip=skip) # type: ignore
return w_q