(self, x: torch.Tensor)
| 61 | self.compute_dtype = compute_dtype |
| 62 | |
| 63 | def forward(self, x: torch.Tensor): |
| 64 | if self.bias is not None and self.bias.dtype != x.dtype: |
| 65 | self.bias.data = self.bias.data.to(x.dtype) |
| 66 | |
| 67 | inp_dtype = x.dtype |
| 68 | |
| 69 | if self.compute_dtype is not None: |
| 70 | x = x.to(self.compute_dtype) |
| 71 | |
| 72 | bias = None if self.bias is None else self.bias.to(self.compute_dtype) |
| 73 | out = None |
| 74 | |
| 75 | quantize_weight = self.weight_quantizer(self.weight.to(self.compute_dtype)) |
| 76 | out = F.linear(x, quantize_weight, bias).to(inp_dtype) |
| 77 | |
| 78 | return out |
nothing calls this directly
no outgoing calls
no test coverage detected