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

Function is_op

imperative/python/megengine/traced_module/_passes/pattern.py:221–232  ·  view source on GitHub ↗
(target)

Source from the content-addressed store, hash-verified

219
220
221def is_op(target):
222 if isinstance(target, type):
223 if issubclass(target, Module):
224 return ModulePattern(target)
225 if issubclass(target, OpDef):
226 return ApplyDefPattern(target)
227 elif callable(target):
228 return FunctionPattern(target)
229 elif isinstance(target, str):
230 return TensorMethodPattern(target)
231 else:
232 raise ValueError("not support")
233
234
235def is_const():

Callers 15

run_transformMethod · 0.85
before_visit_graphMethod · 0.85
__init__Method · 0.85
_make_patternMethod · 0.85
run_transformMethod · 0.85
__add__Method · 0.85
__iadd__Method · 0.85
__radd__Method · 0.85
__sub__Method · 0.85
__isub__Method · 0.85
__rsub__Method · 0.85
__mul__Method · 0.85

Calls 4

ModulePatternClass · 0.85
ApplyDefPatternClass · 0.85
FunctionPatternClass · 0.85
TensorMethodPatternClass · 0.85

Tested by

no test coverage detected