MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / lsq_forward

Function lsq_forward

imperative/python/megengine/quantization/utils.py:38–45  ·  view source on GitHub ↗
(qmin, qmax, inp, step_size, zero_point=None, scale_grad=None)

Source from the content-addressed store, hash-verified

36
37
38def lsq_forward(qmin, qmax, inp, step_size, zero_point=None, scale_grad=None):
39 if zero_point is None:
40 zero_point = Tensor([0.0], dtype=np.float32)
41 if scale_grad is None:
42 scale_grad = Tensor([1.0], dtype=np.float32)
43 op = builtin.LSQ(qmin=qmin, qmax=qmax)
44 (output,) = apply(op, inp, step_size, zero_point, scale_grad)
45 return output
46
47
48def register_method_to_class(cls):

Callers 4

test_lsqFunction · 0.90
testerFunction · 0.90
funcFunction · 0.90
fake_quant_forwardMethod · 0.85

Calls 2

TensorClass · 0.50
applyFunction · 0.50

Tested by 3

test_lsqFunction · 0.72
testerFunction · 0.72
funcFunction · 0.72