megengine.traced_module.traced_module.InternalGraph.insert_exprs¶
- InternalGraph.insert_exprs(expr=None)[源代码]¶
Initialize the trace mode and insertion position.
When used within a ‘with’ statement, this will temporary set the trace mode and then restore normal mode when the with statement exits:
with graph.insert_exprs(e): # set the trace mode ... # trace function or module ... # inert exprs into graph and resotre normal mode
- 参数
expr (
Optional
[Expr
]) – theexpr
after which to insert. If None, the insertion position will be automatically set based on the input node.- 返回
A resource manager that will initialize trace mode on
__enter__
and restore normal mode on__exit__
.