(self, input_)
| 87 | self.weight_zero = Parameter(self.weight_zero.to(kwargs["device"]), requires_grad=False) |
| 88 | |
| 89 | def forward(self, input_): |
| 90 | # Matrix multiply. |
| 91 | output = torch._C.fused_linear_with_groupwise_quantized_weight(input_, |
| 92 | w=self.weight, |
| 93 | w_scale=self.weight_scale, |
| 94 | w_zero=self.weight_zero, |
| 95 | b=self.bias if self.bias is not None else None, |
| 96 | num_bits=self.weight_bit_width, |
| 97 | symmetric=self.symmetric, |
| 98 | group_dim=self.group_dim, |
| 99 | group_size=self.group_size) |
| 100 | |
| 101 | return output |
| 102 | |
| 103 | def quantize_oneflow(model, weight_bit_width): |
| 104 | """Replace fp16 linear with quantized linear""" |
nothing calls this directly
no outgoing calls
no test coverage detected