MCPcopy Create free account
hub / github.com/OpenMOSS/MOSS / forward

Method forward

models/quantization.py:365–370  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

363 self.qzeros = torch.from_numpy(qzeros)
364
365 def forward(self, x):
366 out_shape = x.shape[:-1] + (self.outfeatures,)
367 out = QuantLinearFunction.apply(x.reshape(-1, x.shape[-1]), self.qweight, self.scales,
368 self.qzeros, self.g_idx, self.bits, self.maxq)
369 out = out + self.bias if self.bias is not None else out
370 return out.reshape(out_shape)
371
372def make_quant(module, names, bits, groupsize, name=''):
373 if isinstance(module, QuantLinear):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected