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

Function fake_quant

imperative/python/test/unit/quantization/test_op.py:18–23  ·  view source on GitHub ↗
(x, scale)

Source from the content-addressed store, hash-verified

16
17
18def fake_quant(x, scale):
19 x = x / scale
20 x = F.round(x)
21 x = F.clip(x, -128, 127)
22 x = x * scale
23 return x
24
25
26@pytest.mark.parametrize("kind", ["abs", "sin", "sub", "mul", "fuse_add_tanh"])

Callers 2

test_elemwiseFunction · 0.70

Calls 1

roundMethod · 0.45

Tested by

no test coverage detected