def forward()

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 ternary."""
        if self.training:
            v1, w_q = quantization.quantizer_ls_ternary(w, skip=skip)
            self.v1.copy_(v1)  # type: ignore
        else:
            _, w_q = quantization.quantizer_ls_ternary(w, self.v1, skip=skip)  # type: ignore
        return w_q