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

Method dump

imperative/python/megengine/jit/tracing.py:1045–1336  ·  view source on GitHub ↗

r"""Serializes trace to file system. Args: file: output file, could be file object or filename. arg_names: names of the input tensors in the traced function. output_names: names of the output tensors in the traced function, use the default

(
        self,
        file,
        *,
        arg_names=None,
        output_names=None,
        append=False,
        keep_var_name: int = 1,
        keep_opr_name: bool = False,
        keep_param_name: bool = False,
        keep_opr_priority: bool = False,
        no_change_graph: bool = False,
        strip_info_file=None,
        append_json=False,
        optimize_for_inference=True,
        user_info: Any = None,
        enable_metadata: bool = True,
        input_data=None,
        repeat=1,
        silent=False,
        no_assert=False,
        maxerr=1e-4,
        resize_input=False,
        input_transform=None,
        dump_format: str = None,
        model_version: int = 2,
        compat_older_version: str = None,
        **kwargs
    )

Source from the content-addressed store, hash-verified

1043 return {"outputs": outputs, "testcases": testcases}
1044
1045 def dump(
1046 self,
1047 file,
1048 *,
1049 arg_names=None,
1050 output_names=None,
1051 append=False,
1052 keep_var_name: int = 1,
1053 keep_opr_name: bool = False,
1054 keep_param_name: bool = False,
1055 keep_opr_priority: bool = False,
1056 no_change_graph: bool = False,
1057 strip_info_file=None,
1058 append_json=False,
1059 optimize_for_inference=True,
1060 user_info: Any = None,
1061 enable_metadata: bool = True,
1062 input_data=None,
1063 repeat=1,
1064 silent=False,
1065 no_assert=False,
1066 maxerr=1e-4,
1067 resize_input=False,
1068 input_transform=None,
1069 dump_format: str = None,
1070 model_version: int = 2,
1071 compat_older_version: str = None,
1072 **kwargs
1073 ):
1074 r"""Serializes trace to file system.
1075
1076 Args:
1077 file: output file, could be file object or filename.
1078 arg_names: names of the input tensors in the traced function.
1079 output_names: names of the output tensors in the traced function,
1080 use the default name if not specified.
1081 append: whether output is appended to ``file``.
1082 Only works when ``file`` is str.
1083 keep_var_name: level for keeping variable names:
1084
1085 * 0: none of the names are kept
1086 * 1: (default)keep names of output vars
1087 * 2: keep names of all (output and internal) vars
1088
1089 keep_opr_name: whether to keep operator names.
1090 keep_param_name: whether to keep param names, so param values can be
1091 easily manipulated after loading model
1092 keep_opr_priority: whether to keep priority setting for operators
1093 no_change_graph: whether to change the compute graph when dump, for
1094 model compatibility, some operators will convert to its compatible
1095 format in this version.
1096
1097 * if set False, some operators maybe convert to other operator for
1098 compatibility, all operators will ensure compatibility.
1099 * if set True, no operator will change in the graph when dump.
1100
1101 strip_info_file: a string for path or a file handler. if is not None,
1102 then the dump information for code strip would be written to ``strip_info_file``

Callers 3

saveFunction · 0.45
_to_jsonMethod · 0.45
dump_graphFunction · 0.45

Calls 10

_make_feedMethod · 0.95
make_constMethod · 0.95
_set_priority_to_idFunction · 0.85
make_dev_tensorFunction · 0.85
itemsMethod · 0.80
keysMethod · 0.80
formatMethod · 0.45
appendMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected