megengine.core.tensor.megbrain_graph.dump_graph¶
- dump_graph(output_vars, *, keep_var_name=1, keep_opr_name=False, keep_param_name=False, keep_opr_priority=False, strip_info_file=None, append_json=False, metadata=None)[源代码]¶
serialize the computing graph of output_vars and get byte result.
- 参数
output_vars (
Union
[Dict
[str
,VarNode
],List
[VarNode
]]) – output variables which are the graph’s end point.keep_var_name (
int
) – 保留变量名的级别:keep_opr_name (
bool
) – 是否要保留算子的名字keep_param_name (
bool
) – 是否要保留参数的名字,为了加载模型后可以简单地对参数做操作keep_opr_priority (
bool
) – 是否保留算子的优先级设置strip_info_file – 路径地址或文件句柄。如果不为空,则导出的代码条信息会被写入``strip_info_file``中。
append_json – 当 strip_info_file 非空时会做检查。如果是真,代码条信息就会被添加到 strip_info_file 的尾部;如果是假,就会覆盖掉 strip_info_file.
注解
The underlying C++ API only accepts a var list. If a dict is given, the vars would be renamed to the given names.
- 返回类型
- 返回
dump result as byte string, and an instance of namedtuple
CompGraphDumpResult
, whose fields are:nr_opr
number of operators dumpedtot_bytes
total bytes for the whole graphtensor_value_bytes
bytes consumed for dumping tensor valuesinputs
names of input tensorsparams
list of names of dumped paramsoutputs
names of output vars