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

Function safe_call

imperative/python/megengine/quantization/quantize.py:150–154  ·  view source on GitHub ↗
(func, qparams)

Source from the content-addressed store, hash-verified

148 module = deepcopy(module)
149
150 def safe_call(func, qparams):
151 inst = func() if func is not None else None
152 if inst is not None and getattr(inst, "set_qparams", None) is not None:
153 inst.set_qparams(qparams)
154 return inst
155
156 def is_qat(mod: Module):
157 return isinstance(mod, QATModule)

Callers 2

set_qconfigMethod · 0.85
reset_qconfigFunction · 0.85

Calls 2

funcFunction · 0.50
set_qparamsMethod · 0.45

Tested by

no test coverage detected