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

Method fake_quant_tensor

lightx2v/utils/quant_utils.py:97–103  ·  view source on GitHub ↗
(self, tensor)

Source from the content-addressed store, hash-verified

95 return tensor, scales, zeros, qmax, qmin
96
97 def fake_quant_tensor(self, tensor):
98 org_shape = tensor.shape
99 org_dtype = tensor.dtype
100 tensor, scales, zeros, qmax, qmin = self.get_tensor_qparams(tensor)
101 tensor = self.quant_dequant(tensor, scales, zeros, qmax, qmin)
102 tensor = self.restore_tensor(tensor, org_shape).to(org_dtype)
103 return tensor
104
105 def real_quant_tensor(self, tensor):
106 org_shape = tensor.shape

Callers 1

quant_utils.pyFile · 0.80

Calls 4

get_tensor_qparamsMethod · 0.95
restore_tensorMethod · 0.95
quant_dequantMethod · 0.45
toMethod · 0.45

Tested by

no test coverage detected