MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / quant

Method quant

lightx2v/utils/quant_utils.py:133–135  ·  view source on GitHub ↗
(self, tensor, scales, zeros, qmax, qmin)

Source from the content-addressed store, hash-verified

131 self.dst_nbins = 2**bit
132
133 def quant(self, tensor, scales, zeros, qmax, qmin):
134 tensor = torch.clamp(torch.round(tensor / scales) + zeros, qmin, qmax)
135 return tensor
136
137 def dequant(self, tensor, scales, zeros):
138 tensor = (tensor - zeros) * scales

Callers 1

quant_dequantMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected