Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/MegEngine/MegEngine
/ fake_quant
Function
fake_quant
imperative/python/test/unit/quantization/test_module.py:49–54 ·
view source on GitHub ↗
(x, scale, qmin, qmax)
Source
from the content-addressed store, hash-verified
47
48
49
def
fake_quant(x, scale, qmin, qmax):
50
x = x / scale
51
x = F.round(x)
52
x = F.clip(x, qmin, qmax)
53
x = x * scale
54
return
x
55
56
57
fake_quant_act = partial(fake_quant, qmin=-128, qmax=127)
Callers
nothing calls this directly
Calls
1
round
Method · 0.45
Tested by
no test coverage detected