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