From c8c0501cd0ee9ebc933897f19a4d779895863655 Mon Sep 17 00:00:00 2001 From: zhangxiaoyong2023 Date: Tue, 14 Nov 2023 17:57:32 +0800 Subject: [PATCH 1/4] add parse for mindir files --- .../datavisual/data_access/file_handler.py | 1 - .../datavisual/data_transform/graph/graph.py | 22 +- .../data_transform/graph/msgraph.py | 293 ++- .../data_transform/ms_data_loader.py | 83 +- .../data_transform/summary_watcher.py | 28 +- .../proto_files/mindinsight_mind_ir.proto | 242 +++ .../proto_files/mindinsight_mind_ir_pb2.py | 1674 +++++++++++++++++ mindinsight/domain/graph/base.py | 6 + 8 files changed, 2326 insertions(+), 23 deletions(-) create mode 100644 mindinsight/datavisual/proto_files/mindinsight_mind_ir.proto create mode 100644 mindinsight/datavisual/proto_files/mindinsight_mind_ir_pb2.py diff --git a/mindinsight/datavisual/data_access/file_handler.py b/mindinsight/datavisual/data_access/file_handler.py index 48392d16..63dbbbcd 100644 --- a/mindinsight/datavisual/data_access/file_handler.py +++ b/mindinsight/datavisual/data_access/file_handler.py @@ -66,7 +66,6 @@ class FileHandler: prefix_index = path.find("://") prefix = path[:prefix_index] if prefix_index >= 0 else "" file_system = _FILE_SYSTEMS.get(prefix, None) - if file_system is None: raise ValueError("No filesystem can be found for prefix %s" % prefix) return file_system diff --git a/mindinsight/datavisual/data_transform/graph/graph.py b/mindinsight/datavisual/data_transform/graph/graph.py index ce4a8fc8..9e116819 100644 --- a/mindinsight/datavisual/data_transform/graph/graph.py +++ b/mindinsight/datavisual/data_transform/graph/graph.py @@ -64,14 +64,23 @@ class Graph: self._leaf_nodes = {} self._full_name_map_name = {} - def build_graph(self, proto_data): + def build_graph(self, proto_data, mindir_graph=False): """This method is used to build the graph.""" logger.info("Start to build graph") start_time = time.time() # Notice: # The following methods are interdependent and cannot be switched at will. - self._parse_data(proto_data) + if mindir_graph: + self._parse_mindir_data(proto_data.graph) + if hasattr(proto_data, 'functions'): + for function in proto_data.functions: + self._parse_mindir_data(function) + self._update_input_after_create_node() + self._update_output_after_create_node() + else: + self._parse_data(proto_data) + self._add_variable_nodes(NodeTypeEnum.PARAMETER.value) self._build_aggregation_scope_nodes() self._process_independent_layout() @@ -196,6 +205,9 @@ class Graph: """ raise NotImplementedError("Before you can build a graph, you need to parse the data.") + def _parse_mindir_data(self, proto_data): + raise NotImplementedError("Before you can build a graph, you need to parse the mindir data.") + def _build_name_scope_nodes(self): """ Build name scope node by every node name. @@ -585,3 +597,9 @@ class Graph: input_attr = getattr(target_node, 'inputs')[subnode.name] input_attr['independent_layout'] = True target_node.add_inputs(subnode.name, input_attr) + + def _update_input_after_create_node(self): + pass + + def _update_output_after_create_node(self): + pass diff --git a/mindinsight/datavisual/data_transform/graph/msgraph.py b/mindinsight/datavisual/data_transform/graph/msgraph.py index 25bafcfa..a9ce4589 100644 --- a/mindinsight/datavisual/data_transform/graph/msgraph.py +++ b/mindinsight/datavisual/data_transform/graph/msgraph.py @@ -13,18 +13,21 @@ # limitations under the License. # ============================================================================ """This file is used to define the MindSpore graph.""" +import re +import time + from mindinsight.datavisual.common.enums import PluginNameEnum from mindinsight.datavisual.common.log import logger from mindinsight.datavisual.data_transform.graph.graph import EdgeTypeEnum, Graph, check_invalid_character from mindinsight.datavisual.data_transform.graph.node import Node from mindinsight.datavisual.data_transform.graph.node_tree import NodeTree from mindinsight.datavisual.proto_files.mindinsight_anf_ir_pb2 import DataType -from mindinsight.domain.graph.base import NodeTypeEnum, DebuggerSource +from mindinsight.domain.graph.base import NodeTypeEnum, DebuggerSource, AttributeType +from mindinsight.datavisual.proto_files.mindinsight_mind_ir_pb2 import _TENSORPROTO_DATATYPE class MSGraph(Graph): """The object describes the MindSpore graph, and it is defined in the anf_ir proto file.""" - def _parse_data(self, proto_data): """ The proto data is parsed and all nodes are stored in the specified structure. @@ -422,3 +425,289 @@ class MSGraph(Graph): def _get_data_type_name_by_value(data_type, value, field_name='data_type'): """Get the data type name by the enum value, data_type refer to `DataType` object.""" return data_type.DESCRIPTOR.fields_by_name[field_name].enum_type.values_by_number[value].name + + def _parse_mindir_data(self, proto_data): + """ + The proto data is parsed and all nodes are stored in the specified structure. + + Args: + proto_data (mind_ir_pb2.GraphProto): Refer to mind_ir_pb2.GraphProto object. + """ + logger.info("Start to parse graph proto data.") + + self._parse_mindir_op_nodes(proto_data.node,proto_data.output) + self._parse_mindir_graph_inputs(proto_data.input) + self._parse_mindir_parameter(proto_data.parameter) + + logger.info("Parse proto data end, normal node count(only contain op node, " + "parameter, const): %s.", self.normal_node_count) + + def _parse_mindir_op_nodes(self, node_protos, output_protos): + """ + Parse `mind_ir_pb2.NodeProto` object, and create a normal node. + + Args: + node_protos (list[mind_ir_pb2.NodeProto]): Refer to mind_ir_pb2.NodeProto. + """ + logger.debug("Start to parse output from graph.") + output_names=[] + for output_proto in output_protos: + output_names.append(output_proto.name) + + logger.debug("Start to parse op nodes from proto.") + for topological_index, node_proto in enumerate(node_protos): + if not node_proto.name: + logger.warning("Finding a node with an empty name will not save it.") + continue + if node_proto.op_type=='Constant': + self._parse_mindir_constant(node_proto) + continue + self._parse_mindir_op_node(topological_index, node_proto, output_names) + + def _parse_mindir_op_node(self, topological_index, node_proto, output_names): + """Parse `mind_ir_pb2.NodeProto` ,`mind_ir_pb2.ValueInfoProto` object, and create a normal node.""" + node_id = node_proto.name + id_match = re.match(r"^(.*?_.*?)_", node_id) + node_name = node_proto.domain + if id_match : + graph_id = id_match.group(1) + if '/' in node_name: + node_name = node_name[:node_name.find('/')] + '[' + graph_id + ']' + node_name[node_name.find('/'):] + else: + node_name = node_name + '[' + graph_id + ']' + + scope = node_name + if '/' in scope: + scope=scope[:scope.rfind('/')] + + # The Graphviz plug-in that the UI USES can't handle these special characters. + check_invalid_character(node_name) + if node_id in output_names: + node_id=node_id[:node_id.find(':')] + + node = Node(name=node_name, node_id=node_id, topological_index=topological_index) + node.full_name = node_name + node_type = node_proto.op_type + type_result=re.search(r'::(.*):',node_type) + if type_result: + node_type=type_result.group(1) + node.type=node_type + if getattr(node_proto, 'source_address', None): + node.stack = DebuggerSource.build_stack_from_source_address(node_proto.source_address) + self._parse_mindir_attributes(node_proto.attribute, node) + self._parse_mindir_node_inputs(node_proto.input, node) + + node.scope = scope + node.output_shape = self._get_shape_by_parse_attr_proto(node_proto.attribute) + node.output_nums = len(node.output_shape) + node.output_data_type = self._get_data_type_by_parse_attr_proto(node_proto.attribute, node) + + self._cache_node(node) + + def _parse_mindir_parameter(self, parameter_protos): + """ + Parse `mind_ir_pb2.TensorProto` object, and create a parameter node. + + Args: + parameter_protos (list[mind_ir_pb2.TensorProto]): Refer to mind_ir_pb2.TensorProto. + """ + logger.debug("Start to parse parameters from proto.") + for parameter in parameter_protos: + if not parameter.name: + logger.warning("Finding a parameter with an empty name will not save it.") + continue + check_invalid_character(parameter.name) + para_name=parameter.name + if ':' in para_name: + para_name=para_name[para_name.rfind(':')+1:] + node = Node(name=para_name, node_id=parameter.name) + node.type = NodeTypeEnum.PARAMETER.value + node.output_shape = [self._get_shape_by_parse_tensor_proto(parameter)] + node.output_nums = len(node.output_shape) + node.output_data_type = self._get_data_type_by_parse_parameter(parameter, node) + attr = dict( + type=self._get_data_type_by_parse_parameter(parameter, node), + shape=str(node.output_shape) + ) + node.add_attr(attr) + + self._cache_node(node) + logger.debug("Foreach graph proto parameters, node id: %s, node name: %s, " + "node def name: %s", node.node_id, node.name, parameter.name) + + def _parse_mindir_graph_inputs(self, input_protos): + for input in input_protos: + if not input.name: + logger.warning("The input proto of graph is empty, will ignore.") + continue + input_name=input.name + if ':' in input_name: + input_name=input_name[input_name.rfind(':')+1:] + check_invalid_character(input_name) + node = Node(name=input_name, node_id=input.name) + node.type = NodeTypeEnum.PARAMETER.value + + input_shapes=[] + if input.HasField('attr_info'): + node.output_data_type=self._get_data_type_name_by_value(input.attr_info,input.attr_info.type,'type') + node.output_shape = input_shapes + node.output_nums = len(node.output_shape) + attr = dict( + type=self._get_data_type_name_by_value(input.attr_info,input.attr_info.type,'type'), + shape=str(input_shapes) + ) + node.add_attr(attr) + self._cache_node(node) + continue + for tensor_proto in input.tensor: + input_shape=self._get_shape_by_parse_tensor_proto(tensor_proto) + if len(input_shape)!=0: + input_shapes.append(input_shape) + if len(input_shapes)==0: + input_shapes.append([]) + node.output_shape = input_shapes + node.output_nums = len(node.output_shape) + node.output_data_type = self._get_data_type_by_parse_tensor_proto(input.tensor, node) + attr = dict( + type=self._get_data_type_by_parse_tensor_proto(input.tensor, node), + shape=str(input_shapes) + ) + node.add_attr(attr) + + self._cache_node(node) + logger.debug("Foreach inputs, node id: %s, node name: %s, " + "node def name: %s", input_name, input_name, input.name) + + + def _parse_mindir_node_inputs(self, input_protos, node): + for input_proto in input_protos: + if not input_proto: + logger.warning("The input proto of node(%s) is empty, will ignore.", node.name) + continue + + # if ":" in input_proto: + # input_proto = input_proto.split(":")[-1] + + edge_type = EdgeTypeEnum.DATA.value + + # Notice: + # 1. The name in the input proto is the node id of the Node object. + # 2. In the current step, the shape of source node cannot be obtained, + # so it is set to empty list by default, and the next step will update it. + # 3. Same with scope, set the default value first. + input_attr = { + "shape": [], + "edge_type": edge_type, + "independent_layout": False, + 'data_type': '' + } + + node.add_inputs(src_name=input_proto, input_attr=input_attr) + + def _parse_mindir_attributes(self, attributes, node): + """ + Parse `mind_ir_pb2.AttributeProto` object., and Filters large attribute values. + + Args: + attributes (list[mind_ir_pb2.AttributeProto]): Refer to `mind_ir_pb2.AttributeProto` object. + node (Node): Refer to `Node` object, it is used to log message and update attr. + """ + for attr in attributes: + node.add_attr({attr.name: str(attr.tensors)}) + + def _parse_mindir_constant(self, cst_proto): + """ + Parse `mind_ir_pb2.NodeProto` object, and create a const node. + + Args: + consts (list[mind_ir_pb2.NodeProto]): Refer to `mind_ir_pb2.NodeProto` object. + """ + logger.debug("Start to parse consts from proto.") + + if not cst_proto.name: + logger.warning("Finding a const with an empty name will not save it.") + return + check_invalid_character(cst_proto.name) + node = Node(name=cst_proto.name, node_id=cst_proto.name, full_name=cst_proto.name) + node.type = NodeTypeEnum.CONST.value + for attr in cst_proto.attribute: + data_type = self._get_data_type_name_by_value(attr, attr.type, 'type') + if attr.ByteSize() > self.MAX_NODE_ATTRIBUTE_VALUE_BYTES: + node.add_attr({cst_proto.name: 'type: ' + data_type}) + else: + node.add_attr({cst_proto.name: str(attr)}) + + node.output_shape=self._get_shape_by_parse_attr_proto(cst_proto.attribute) + node.output_nums = len(node.output_shape) + self._get_data_type_by_parse_attr_proto(cst_proto.attribute, node) + + # dim is zero + if(node.output_nums == 0): + node.output_shape.append([]) + + self._cache_node(node) + + def _get_shape_by_parse_attr_proto(self, attr_proto): + shapes=[] + for attr in attr_proto: + if self._get_data_type_name_by_value(attr,attr.type,'type')==AttributeType.TENSORS.value: + for tensor in attr.tensors: + shapes.append(self._get_shape_by_parse_tensor_proto(tensor)) + continue + if self._get_data_type_name_by_value(attr,attr.type,'type')==AttributeType.TUPLE.value: + shapes.extend(self._get_shape_by_parse_attr_proto(attr.values)) + else: + shapes.extend([]) + return shapes + + def _get_shape_by_parse_tensor_proto(self, tensor_proto): + """ + Parse proto's `message TensorProto` to get shape information. + + Args: + type_proto (mind_ir_pb2.TensorProto): Refer to mind_ir_pb2.TensorProto. + + Returns: + list, a list of shape. + """ + + shape=[] + for dim in tensor_proto.dims: + shape.append(dim) + return shape + + def _get_data_type_by_parse_attr_proto(self, attr_proto, node): + data_types=[] + for attr in attr_proto: + if self._get_data_type_name_by_value(attr, attr.type, 'type') == AttributeType.TENSORS.value: + elem_types=[] + for tensor in attr.tensors: + data_type_name = self._get_data_type_name(tensor) + node.elem_types.append(data_type_name) + elem_types.append(data_type_name) + data_types.append(f'{AttributeType.TENSORS.value}{str(elem_types)}') + if self._get_data_type_name_by_value(attr, attr.type, 'type') == AttributeType.TUPLE.value: + data_type=self._get_data_type_by_parse_attr_proto(attr.values, node) + data_types.append(f'{AttributeType.TUPLE.value}{str(data_type)}') + if len(data_types)>0: + return data_types[0] + else: + return "" + + def _get_data_type_by_parse_parameter(self, parameter, node): + data_type_name = self._get_data_type_name(parameter) + node.elem_types.append(data_type_name) + return str([data_type_name]) + + def _get_data_type_by_parse_tensor_proto(self, tensor_protos, node): + data_types=[] + for tensor_proto in tensor_protos: + elem_type_name=self._get_data_type_name(tensor_proto) + node.elem_types.append(elem_type_name) + data_types.append(elem_type_name) + return str(data_types) + + @staticmethod + def _get_data_type_name(tensor_proto): + """Get the data type name by the enum value, data_type refer to `DataType` object.""" + return _TENSORPROTO_DATATYPE.values_by_number[tensor_proto.data_type].name diff --git a/mindinsight/datavisual/data_transform/ms_data_loader.py b/mindinsight/datavisual/data_transform/ms_data_loader.py index 0b0b8e66..39e41682 100644 --- a/mindinsight/datavisual/data_transform/ms_data_loader.py +++ b/mindinsight/datavisual/data_transform/ms_data_loader.py @@ -42,6 +42,7 @@ from mindinsight.datavisual.data_transform.tensor_container import TensorContain from mindinsight.datavisual.data_transform.loss_landscape_container import LossLandscapeContainer from mindinsight.datavisual.proto_files import mindinsight_anf_ir_pb2 as anf_ir_pb2 from mindinsight.datavisual.proto_files import mindinsight_summary_pb2 as summary_pb2 +from mindinsight.datavisual.proto_files import mindinsight_mind_ir_pb2 as mind_ir_pb2 from mindinsight.datavisual.utils.tools import exception_no_raise_wrapper from mindinsight.utils.computing_resource_mgr import ComputingResourceManager, Executor from mindinsight.utils.exceptions import UnknownError @@ -67,6 +68,7 @@ class MSDataLoader: self._parser_list = [] self._parser_list.append(_SummaryParser(summary_dir)) self._parser_list.append(_PbParser(summary_dir)) + self._parser_list.append(_MindirParser(summary_dir)) self._is_integrity = True @property @@ -565,25 +567,96 @@ class _SummaryParser(_Parser): return filenames -def build_graph_events(graph_proto, filename, step, wall_time): +class _MindirParser(_Parser): + def __init__(self, summary_dir): + super(_MindirParser, self).__init__(summary_dir) + self._latest_mtime = 0 + + def parse_files(self, executor, filenames, events_data): + mindir_filenames=self.filter_files(filenames) + mindir_filenames=self.sort_files(mindir_filenames) + for filename in mindir_filenames: + if not self._set_latest_file(filename): + continue + future = executor.submit(self._parse_mindir_file, self._summary_dir, filename) + + def add_tensor_event(future_value): + tensor_events = future_value.result() + for tensor_event in tensor_events: + if tensor_event is not None: + events_data.add_tensor_event(tensor_event) + + if future is not None: + future.add_done_callback(exception_no_raise_wrapper(add_tensor_event)) + return False + return True + def filter_files(self, filenames): + return list(filter(lambda filename: re.search(r'\.mindir$', filename), filenames)) + + def sort_files(self, filenames): + """Sort by modify time increments and filenames increments.""" + filenames = sorted(filenames, key=lambda file: ( + FileHandler.file_stat(FileHandler.join(self._summary_dir, file)).mtime, file)) + return filenames + + def _set_latest_file(self, filename): + mtime = FileHandler.file_stat(FileHandler.join(self._summary_dir, filename)).mtime + if mtime < self._latest_mtime or \ + (mtime == self._latest_mtime and filename <= self._latest_filename): + return False + + self._latest_mtime = mtime + self._latest_filename = filename + + return True + + @staticmethod + def _parse_mindir_file(summary_dir, filename): + """ + Parse mindir file and write content to `EventsData`. + + Args: + filename (str): The file path of mindir file. + + Returns: + TensorEvent, if load mindir file and build graph success, will return tensor event, else return None. + """ + file_path = FileHandler.join(summary_dir, filename) + logger.info("Start to load graph from mindir file, file path: %s.", file_path) + filehandler = FileHandler(file_path) + model_proto = mind_ir_pb2.ModelProto() + + try: + model_proto.ParseFromString(filehandler.read()) + except ParseError: + logger.warning("The given file is not a valid mindir file, file path: %s.", file_path) + return None + ret_tensor_events = build_graph_events(model_proto, filename, 0, FileHandler.file_stat(file_path).mtime,True) + + logger.info("Build graph success, file path: %s.", file_path) + return ret_tensor_events + + +def build_graph_events(graph_proto, filename, step, wall_time, mindir_graph=False): """Build graph events for MSgraph and OptimizedGraph.""" ret_tensor_events = [] - graph_event = build_graph_event(graph_proto, PluginNameEnum.GRAPH.value, filename, step, wall_time) + graph_event = build_graph_event(graph_proto, PluginNameEnum.GRAPH.value, filename, step, wall_time, mindir_graph) if graph_event.value.list_node_by_scope(): ret_tensor_events.append(graph_event) optimized_graph_event = build_graph_event(graph_proto, PluginNameEnum.OPTIMIZED_GRAPH.value, filename, step, - wall_time) + wall_time, mindir_graph) if optimized_graph_event.value.list_node_by_scope(): ret_tensor_events.append(optimized_graph_event) return ret_tensor_events -def build_graph_event(graph_proto, plugin, filename, step, wall_time): +def build_graph_event(graph_proto, plugin, filename, step, wall_time, mindir_graph=False): """Build a graph event.""" graph = MSGraph() if plugin == PluginNameEnum.GRAPH.value else OptimizedGraph() try: - graph.build_graph(graph_proto) + graph.build_graph(graph_proto, mindir_graph) + except Exception as ex: # Normally, there are no exceptions, and it is only possible for users on the MindSpore side # to dump other non-default graphs. diff --git a/mindinsight/datavisual/data_transform/summary_watcher.py b/mindinsight/datavisual/data_transform/summary_watcher.py index 589981d9..84cdee0d 100644 --- a/mindinsight/datavisual/data_transform/summary_watcher.py +++ b/mindinsight/datavisual/data_transform/summary_watcher.py @@ -37,9 +37,10 @@ class SummaryWatcher: SUMMARY_FILENAME_REGEX = r'summary\.(?P\d+)' PB_FILENAME_REGEX = r'\.pb$' + MINDIR_FILENAME_REGEX=r'\.mindir$' PROFILER_DIRECTORY_REGEX = r'^profiler' MAX_SUMMARY_DIR_COUNT = 999 - SUMMARY_PB_BLACKLIST = { + SUMMARY_PB_MINDIR_BLACKLIST = { "memory_usage_regex": r'^memory_usage_\d+\.pb$' } @@ -126,7 +127,6 @@ class SummaryWatcher: # sort by update time in descending order and relative path in ascending order directories.sort(key=lambda x: (-int(x['update_time'].timestamp()), x['relative_path'])) - return directories def _scan_subdir_entries(self, summary_dict, summary_base_dir, entry_path, entry, counter, list_explain): @@ -246,7 +246,8 @@ class SummaryWatcher: """"Update the summary dict by checking file.""" summary_pattern = re.search(self.SUMMARY_FILENAME_REGEX, entry.name) pb_pattern = re.search(self.PB_FILENAME_REGEX, entry.name) - if not self._is_valid_pattern_result(summary_pattern, pb_pattern, list_explain, entry): + mindir_pattern=re.search(self.MINDIR_FILENAME_REGEX, entry.name) + if not self._is_valid_pattern_result(summary_pattern, pb_pattern, mindir_pattern, list_explain, entry): return True timestamp = None @@ -310,11 +311,12 @@ class SummaryWatcher: return profiler_type, True - def _is_valid_pattern_result(self, summary_pattern, pb_pattern, list_explain, entry): + def _is_valid_pattern_result(self, summary_pattern, pb_pattern, mindir_pattern, list_explain, entry): """Check the pattern result is valid.""" - is_in_summary_pb_blacklist = self._check_by_blacklist(entry.name) - is_valid_pb = pb_pattern is not None and not is_in_summary_pb_blacklist - if summary_pattern is None and not is_valid_pb: + is_in_summary_pb_mindir_blacklist = self._check_by_blacklist(entry.name) + is_valid_pb = pb_pattern is not None and not is_in_summary_pb_mindir_blacklist + is_valid_mindir=mindir_pattern is not None and not is_in_summary_pb_mindir_blacklist + if summary_pattern is None and not is_valid_pb and not is_valid_mindir: return False if list_explain and not entry.name.endswith(EXPLAIN_SUMMARY_SUFFIX): return False @@ -325,10 +327,10 @@ class SummaryWatcher: def _check_by_blacklist(self, name): """Check if the file is in blacklist.""" - is_in_summary_pb_blacklist = False - for regex in self.SUMMARY_PB_BLACKLIST.values(): - is_in_summary_pb_blacklist = is_in_summary_pb_blacklist or re.search(regex, name) is not None - return is_in_summary_pb_blacklist + is_in_summary_pb_mindir_blacklist = False + for regex in self.SUMMARY_PB_MINDIR_BLACKLIST.values(): + is_in_summary_pb_mindir_blacklist = is_in_summary_pb_mindir_blacklist or re.search(regex, name) is not None + return is_in_summary_pb_mindir_blacklist def is_summary_directory(self, summary_base_dir, relative_path): """ @@ -369,8 +371,8 @@ class SummaryWatcher: return True pb_pattern = re.search(self.PB_FILENAME_REGEX, entry.name) - is_in_summary_pb_blacklist = self._check_by_blacklist(entry.name) - if pb_pattern is not None and entry.is_file() and not is_in_summary_pb_blacklist: + is_in_summary_pb_mindir_blacklist = self._check_by_blacklist(entry.name) + if pb_pattern is not None and entry.is_file() and not is_in_summary_pb_mindir_blacklist: return True if entry.is_dir(): diff --git a/mindinsight/datavisual/proto_files/mindinsight_mind_ir.proto b/mindinsight/datavisual/proto_files/mindinsight_mind_ir.proto new file mode 100644 index 00000000..5028cf5b --- /dev/null +++ b/mindinsight/datavisual/proto_files/mindinsight_mind_ir.proto @@ -0,0 +1,242 @@ +syntax = "proto2"; +package mind_ir; + +enum Version { + IR_VERSION_START = 0; + IR_VERSION = 1; +} + +message AttributeProto { + enum AttributeType { + UNDEFINED = 0; + FLOAT = 1; + UINT8 = 2; + INT8 = 3; + UINT16 = 4; + INT16 = 5; + INT32 = 6; + INT64 = 7; + STRING = 8; + BOOL = 9; + FLOAT16 = 10; + DOUBLE = 11; + UINT32 = 12; + UINT64 = 13; + COMPLEX64 = 14; + COMPLEX128 = 15; + BFLOAT16 = 16; + TENSOR = 17; + GRAPH = 18; + TENSORS = 19; + TUPLE = 20; // tuple + LIST = 21; // list + DICT = 22; // dictionary + UMONAD = 23; + IOMONAD = 24; + NONE = 25; + PRIMITIVECLOSURE = 26; + FUNCGRAPHCLOSURE = 27; + PARTIALCLOSURE = 28; + UNIONFUNCCLOSURE = 29; + CSR_TENSOR = 30; + COO_TENSOR = 31; + ROW_TENSOR = 32; + CLASS_TYPE = 33; + NAME_SPACE = 34; + SYMBOL = 35; + TYPE_NULL = 36; + MAP_TENSOR = 37; + FUNCTOR = 38; + SCALAR = 39; + } + message SeqInfoProto{ + optional bool is_dyn_len = 1; // store if tuple is dynamic length + optional AttributeProto tuple_elem_item = 2; // store the element of tuple dynamic length + } + optional string name = 1; + optional float f = 2; + optional int64 i = 3; + optional double d = 4; + optional bytes s = 5; + optional TensorProto t = 6; + optional GraphProto g = 7; + repeated float floats = 8; + repeated double doubles = 9; + repeated int64 ints = 10; + repeated bytes strings = 11; + repeated TensorProto tensors = 12; + repeated GraphProto graphs = 13; + optional string doc_string = 14; + optional string ref_attr_name = 15; + optional AttributeType type = 16; + repeated AttributeProto values = 17; // tuple, list, dict of value + optional SeqInfoProto seq_info = 18; // tuple, list, structural info + optional FunctorProto functor = 19; +} + +message FunctorProto { + enum FunctorType { + SHAPE_CALC_FUNCTOR = 1; + } + optional FunctorType type = 1; + optional string name = 2; + repeated AttributeProto values = 3; +} + +message ValueInfoProto { + optional string name = 1; + repeated TensorProto tensor = 2; + optional string doc_string = 3; + optional string denotation = 4; + optional AttributeProto attr_info = 5; // graph input info for other type +} + + +message NodeProto { + repeated string input = 1; + repeated string output = 2; + optional string name = 3; + optional string op_type = 4; + repeated AttributeProto attribute = 5; + optional string doc_string = 6; + optional string domain = 7; + repeated AttributeProto node_attr = 8; + repeated AttributeProto primal_attr = 9; +} + + +message ModelProto { + optional string ir_version = 1; + optional string producer_name = 2; + optional string producer_version = 3; + optional string domain = 4; + optional string model_version = 5; + optional string doc_string = 6; + optional GraphProto graph = 7; + repeated GraphProto functions = 8; // all the graphs without the main graph. + optional PreprocessorProto preprocessor = 9; // data graph from MindData. + optional bool little_endian = 10; // bytes order in load device. + optional ParallelProto parallel = 11; // information for parallel. + repeated PrimitiveProto primitives = 12; // all the primitives of the model. + optional int64 mind_ir_version = 13; +} + + +message PreprocessorProto { + repeated PreprocessOpProto op = 1; +} + + +message PreprocessOpProto { + optional string input_columns = 1; + optional string output_columns = 2; + optional string project_columns = 3; + optional string op_type = 4; + optional string operations = 5; + optional bool offload = 6; +} + + +message GraphProto { + repeated NodeProto node = 1; + optional string name = 2; + repeated TensorProto parameter = 3; + optional string doc_string = 4; + repeated ValueInfoProto input = 5; + repeated ValueInfoProto output = 6; + optional string bprop_hash = 7; + repeated AttributeProto attribute = 8; + optional string bprop_filepath = 9; + repeated MapTensorProto map_parameter = 10; +} + + +message TensorProto { + enum DataType { + UNDEFINED = 0; + // Basic types. + FLOAT = 1; // float + UINT8 = 2; // uint8_t + INT8 = 3; // int8_t + UINT16 = 4; // uint16_t + INT16 = 5; // int16_t + INT32 = 6; // int32_t + INT64 = 7; // int64_t + STRING = 8; // string + BOOL = 9; // bool + FLOAT16 = 10; + DOUBLE = 11; + UINT32 = 12; + UINT64 = 13; + COMPLEX64 = 14; + COMPLEX128 = 15; + BFLOAT16 = 16; + FLOAT64 = 17; + } + enum CompressionType { + NO_COMPRESSION = 0; + INDEXING = 1; + SPARSE = 2; + FSE = 3; + BIT_PACKING = 4; + FSE_INT = 5; + FSE_INFER = 6; + } + message ExternalDataProto { + //POSIX filesystem path relative to the directory where the MindIR model was stored. + optional string location = 1; + optional int64 offset = 2; + optional int64 length = 3; + optional string checksum = 4; + } + message QuantParamProto { + required string quant_algo_name = 1; + repeated AttributeProto attribute = 2; + } + repeated int64 dims = 1; + optional int32 data_type = 2; + repeated float float_data = 3; + repeated int32 int32_data = 4; + repeated bytes string_data = 5; + repeated int64 int64_data = 6; + optional string name = 7; + optional string doc_string = 8; + optional bytes raw_data = 9; + repeated double double_data = 10; + repeated uint64 uint64_data = 11; + optional ExternalDataProto external_data = 12; + optional string ref_key = 13; + repeated int64 min_dims = 14; + repeated int64 max_dims = 15; + optional CompressionType compression_type = 16; + repeated QuantParamProto quant_params = 17; +} + +message MapTensorProto { + required string name = 1; + required AttributeProto default_value = 2; + required TensorProto key_tensor = 3; + required TensorProto value_tensor = 4; + required TensorProto status_tensor = 5; +} + +message ParallelProto { + repeated LayoutProto layout = 1; +} + +message LayoutProto { + optional string name = 1; + repeated int64 device_arrangement_int = 2; + repeated int64 tensor_map_int = 3; + repeated int64 slice_shape_int = 4; + optional int64 field_size = 5; + optional bool uniform_split = 6; + optional string opt_shard_group = 7; +} + +message PrimitiveProto { + optional string name = 1; + optional string op_type = 2; + repeated AttributeProto attribute = 3; + optional string instance_name = 4; +} \ No newline at end of file diff --git a/mindinsight/datavisual/proto_files/mindinsight_mind_ir_pb2.py b/mindinsight/datavisual/proto_files/mindinsight_mind_ir_pb2.py new file mode 100644 index 00000000..33492783 --- /dev/null +++ b/mindinsight/datavisual/proto_files/mindinsight_mind_ir_pb2.py @@ -0,0 +1,1674 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: mindinsight_mind_ir.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='mindinsight_mind_ir.proto', + package='mind_ir', + serialized_pb=_b('\n\x19mindinsight_mind_ir.proto\x12\x07mind_ir\"\x88\t\n\x0e\x41ttributeProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\t\n\x01\x66\x18\x02 \x01(\x02\x12\t\n\x01i\x18\x03 \x01(\x03\x12\t\n\x01\x64\x18\x04 \x01(\x01\x12\t\n\x01s\x18\x05 \x01(\x0c\x12\x1f\n\x01t\x18\x06 \x01(\x0b\x32\x14.mind_ir.TensorProto\x12\x1e\n\x01g\x18\x07 \x01(\x0b\x32\x13.mind_ir.GraphProto\x12\x0e\n\x06\x66loats\x18\x08 \x03(\x02\x12\x0f\n\x07\x64oubles\x18\t \x03(\x01\x12\x0c\n\x04ints\x18\n \x03(\x03\x12\x0f\n\x07strings\x18\x0b \x03(\x0c\x12%\n\x07tensors\x18\x0c \x03(\x0b\x32\x14.mind_ir.TensorProto\x12#\n\x06graphs\x18\r \x03(\x0b\x32\x13.mind_ir.GraphProto\x12\x12\n\ndoc_string\x18\x0e \x01(\t\x12\x15\n\rref_attr_name\x18\x0f \x01(\t\x12\x33\n\x04type\x18\x10 \x01(\x0e\x32%.mind_ir.AttributeProto.AttributeType\x12\'\n\x06values\x18\x11 \x03(\x0b\x32\x17.mind_ir.AttributeProto\x12\x36\n\x08seq_info\x18\x12 \x01(\x0b\x32$.mind_ir.AttributeProto.SeqInfoProto\x12&\n\x07\x66unctor\x18\x13 \x01(\x0b\x32\x15.mind_ir.FunctorProto\x1aT\n\x0cSeqInfoProto\x12\x12\n\nis_dyn_len\x18\x01 \x01(\x08\x12\x30\n\x0ftuple_elem_item\x18\x02 \x01(\x0b\x32\x17.mind_ir.AttributeProto\"\xaf\x04\n\rAttributeType\x12\r\n\tUNDEFINED\x10\x00\x12\t\n\x05\x46LOAT\x10\x01\x12\t\n\x05UINT8\x10\x02\x12\x08\n\x04INT8\x10\x03\x12\n\n\x06UINT16\x10\x04\x12\t\n\x05INT16\x10\x05\x12\t\n\x05INT32\x10\x06\x12\t\n\x05INT64\x10\x07\x12\n\n\x06STRING\x10\x08\x12\x08\n\x04\x42OOL\x10\t\x12\x0b\n\x07\x46LOAT16\x10\n\x12\n\n\x06\x44OUBLE\x10\x0b\x12\n\n\x06UINT32\x10\x0c\x12\n\n\x06UINT64\x10\r\x12\r\n\tCOMPLEX64\x10\x0e\x12\x0e\n\nCOMPLEX128\x10\x0f\x12\x0c\n\x08\x42\x46LOAT16\x10\x10\x12\n\n\x06TENSOR\x10\x11\x12\t\n\x05GRAPH\x10\x12\x12\x0b\n\x07TENSORS\x10\x13\x12\t\n\x05TUPLE\x10\x14\x12\x08\n\x04LIST\x10\x15\x12\x08\n\x04\x44ICT\x10\x16\x12\n\n\x06UMONAD\x10\x17\x12\x0b\n\x07IOMONAD\x10\x18\x12\x08\n\x04NONE\x10\x19\x12\x14\n\x10PRIMITIVECLOSURE\x10\x1a\x12\x14\n\x10\x46UNCGRAPHCLOSURE\x10\x1b\x12\x12\n\x0ePARTIALCLOSURE\x10\x1c\x12\x14\n\x10UNIONFUNCCLOSURE\x10\x1d\x12\x0e\n\nCSR_TENSOR\x10\x1e\x12\x0e\n\nCOO_TENSOR\x10\x1f\x12\x0e\n\nROW_TENSOR\x10 \x12\x0e\n\nCLASS_TYPE\x10!\x12\x0e\n\nNAME_SPACE\x10\"\x12\n\n\x06SYMBOL\x10#\x12\r\n\tTYPE_NULL\x10$\x12\x0e\n\nMAP_TENSOR\x10%\x12\x0b\n\x07\x46UNCTOR\x10&\x12\n\n\x06SCALAR\x10\'\"\x9d\x01\n\x0c\x46unctorProto\x12/\n\x04type\x18\x01 \x01(\x0e\x32!.mind_ir.FunctorProto.FunctorType\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\'\n\x06values\x18\x03 \x03(\x0b\x32\x17.mind_ir.AttributeProto\"%\n\x0b\x46unctorType\x12\x16\n\x12SHAPE_CALC_FUNCTOR\x10\x01\"\x98\x01\n\x0eValueInfoProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12$\n\x06tensor\x18\x02 \x03(\x0b\x32\x14.mind_ir.TensorProto\x12\x12\n\ndoc_string\x18\x03 \x01(\t\x12\x12\n\ndenotation\x18\x04 \x01(\t\x12*\n\tattr_info\x18\x05 \x01(\x0b\x32\x17.mind_ir.AttributeProto\"\xf3\x01\n\tNodeProto\x12\r\n\x05input\x18\x01 \x03(\t\x12\x0e\n\x06output\x18\x02 \x03(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x0f\n\x07op_type\x18\x04 \x01(\t\x12*\n\tattribute\x18\x05 \x03(\x0b\x32\x17.mind_ir.AttributeProto\x12\x12\n\ndoc_string\x18\x06 \x01(\t\x12\x0e\n\x06\x64omain\x18\x07 \x01(\t\x12*\n\tnode_attr\x18\x08 \x03(\x0b\x32\x17.mind_ir.AttributeProto\x12,\n\x0bprimal_attr\x18\t \x03(\x0b\x32\x17.mind_ir.AttributeProto\"\x91\x03\n\nModelProto\x12\x12\n\nir_version\x18\x01 \x01(\t\x12\x15\n\rproducer_name\x18\x02 \x01(\t\x12\x18\n\x10producer_version\x18\x03 \x01(\t\x12\x0e\n\x06\x64omain\x18\x04 \x01(\t\x12\x15\n\rmodel_version\x18\x05 \x01(\t\x12\x12\n\ndoc_string\x18\x06 \x01(\t\x12\"\n\x05graph\x18\x07 \x01(\x0b\x32\x13.mind_ir.GraphProto\x12&\n\tfunctions\x18\x08 \x03(\x0b\x32\x13.mind_ir.GraphProto\x12\x30\n\x0cpreprocessor\x18\t \x01(\x0b\x32\x1a.mind_ir.PreprocessorProto\x12\x15\n\rlittle_endian\x18\n \x01(\x08\x12(\n\x08parallel\x18\x0b \x01(\x0b\x32\x16.mind_ir.ParallelProto\x12+\n\nprimitives\x18\x0c \x03(\x0b\x32\x17.mind_ir.PrimitiveProto\x12\x17\n\x0fmind_ir_version\x18\r \x01(\x03\";\n\x11PreprocessorProto\x12&\n\x02op\x18\x01 \x03(\x0b\x32\x1a.mind_ir.PreprocessOpProto\"\x91\x01\n\x11PreprocessOpProto\x12\x15\n\rinput_columns\x18\x01 \x01(\t\x12\x16\n\x0eoutput_columns\x18\x02 \x01(\t\x12\x17\n\x0fproject_columns\x18\x03 \x01(\t\x12\x0f\n\x07op_type\x18\x04 \x01(\t\x12\x12\n\noperations\x18\x05 \x01(\t\x12\x0f\n\x07offload\x18\x06 \x01(\x08\"\xd2\x02\n\nGraphProto\x12 \n\x04node\x18\x01 \x03(\x0b\x32\x12.mind_ir.NodeProto\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\'\n\tparameter\x18\x03 \x03(\x0b\x32\x14.mind_ir.TensorProto\x12\x12\n\ndoc_string\x18\x04 \x01(\t\x12&\n\x05input\x18\x05 \x03(\x0b\x32\x17.mind_ir.ValueInfoProto\x12\'\n\x06output\x18\x06 \x03(\x0b\x32\x17.mind_ir.ValueInfoProto\x12\x12\n\nbprop_hash\x18\x07 \x01(\t\x12*\n\tattribute\x18\x08 \x03(\x0b\x32\x17.mind_ir.AttributeProto\x12\x16\n\x0e\x62prop_filepath\x18\t \x01(\t\x12.\n\rmap_parameter\x18\n \x03(\x0b\x32\x17.mind_ir.MapTensorProto\"\xdf\x07\n\x0bTensorProto\x12\x0c\n\x04\x64ims\x18\x01 \x03(\x03\x12\x11\n\tdata_type\x18\x02 \x01(\x05\x12\x12\n\nfloat_data\x18\x03 \x03(\x02\x12\x12\n\nint32_data\x18\x04 \x03(\x05\x12\x13\n\x0bstring_data\x18\x05 \x03(\x0c\x12\x12\n\nint64_data\x18\x06 \x03(\x03\x12\x0c\n\x04name\x18\x07 \x01(\t\x12\x12\n\ndoc_string\x18\x08 \x01(\t\x12\x10\n\x08raw_data\x18\t \x01(\x0c\x12\x13\n\x0b\x64ouble_data\x18\n \x03(\x01\x12\x13\n\x0buint64_data\x18\x0b \x03(\x04\x12=\n\rexternal_data\x18\x0c \x01(\x0b\x32&.mind_ir.TensorProto.ExternalDataProto\x12\x0f\n\x07ref_key\x18\r \x01(\t\x12\x10\n\x08min_dims\x18\x0e \x03(\x03\x12\x10\n\x08max_dims\x18\x0f \x03(\x03\x12>\n\x10\x63ompression_type\x18\x10 \x01(\x0e\x32$.mind_ir.TensorProto.CompressionType\x12:\n\x0cquant_params\x18\x11 \x03(\x0b\x32$.mind_ir.TensorProto.QuantParamProto\x1aW\n\x11\x45xternalDataProto\x12\x10\n\x08location\x18\x01 \x01(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x03\x12\x0e\n\x06length\x18\x03 \x01(\x03\x12\x10\n\x08\x63hecksum\x18\x04 \x01(\t\x1aV\n\x0fQuantParamProto\x12\x17\n\x0fquant_algo_name\x18\x01 \x02(\t\x12*\n\tattribute\x18\x02 \x03(\x0b\x32\x17.mind_ir.AttributeProto\"\xe7\x01\n\x08\x44\x61taType\x12\r\n\tUNDEFINED\x10\x00\x12\t\n\x05\x46LOAT\x10\x01\x12\t\n\x05UINT8\x10\x02\x12\x08\n\x04INT8\x10\x03\x12\n\n\x06UINT16\x10\x04\x12\t\n\x05INT16\x10\x05\x12\t\n\x05INT32\x10\x06\x12\t\n\x05INT64\x10\x07\x12\n\n\x06STRING\x10\x08\x12\x08\n\x04\x42OOL\x10\t\x12\x0b\n\x07\x46LOAT16\x10\n\x12\n\n\x06\x44OUBLE\x10\x0b\x12\n\n\x06UINT32\x10\x0c\x12\n\n\x06UINT64\x10\r\x12\r\n\tCOMPLEX64\x10\x0e\x12\x0e\n\nCOMPLEX128\x10\x0f\x12\x0c\n\x08\x42\x46LOAT16\x10\x10\x12\x0b\n\x07\x46LOAT64\x10\x11\"u\n\x0f\x43ompressionType\x12\x12\n\x0eNO_COMPRESSION\x10\x00\x12\x0c\n\x08INDEXING\x10\x01\x12\n\n\x06SPARSE\x10\x02\x12\x07\n\x03\x46SE\x10\x03\x12\x0f\n\x0b\x42IT_PACKING\x10\x04\x12\x0b\n\x07\x46SE_INT\x10\x05\x12\r\n\tFSE_INFER\x10\x06\"\xd1\x01\n\x0eMapTensorProto\x12\x0c\n\x04name\x18\x01 \x02(\t\x12.\n\rdefault_value\x18\x02 \x02(\x0b\x32\x17.mind_ir.AttributeProto\x12(\n\nkey_tensor\x18\x03 \x02(\x0b\x32\x14.mind_ir.TensorProto\x12*\n\x0cvalue_tensor\x18\x04 \x02(\x0b\x32\x14.mind_ir.TensorProto\x12+\n\rstatus_tensor\x18\x05 \x02(\x0b\x32\x14.mind_ir.TensorProto\"5\n\rParallelProto\x12$\n\x06layout\x18\x01 \x03(\x0b\x32\x14.mind_ir.LayoutProto\"\xb0\x01\n\x0bLayoutProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x1e\n\x16\x64\x65vice_arrangement_int\x18\x02 \x03(\x03\x12\x16\n\x0etensor_map_int\x18\x03 \x03(\x03\x12\x17\n\x0fslice_shape_int\x18\x04 \x03(\x03\x12\x12\n\nfield_size\x18\x05 \x01(\x03\x12\x15\n\runiform_split\x18\x06 \x01(\x08\x12\x17\n\x0fopt_shard_group\x18\x07 \x01(\t\"r\n\x0ePrimitiveProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07op_type\x18\x02 \x01(\t\x12*\n\tattribute\x18\x03 \x03(\x0b\x32\x17.mind_ir.AttributeProto\x12\x15\n\rinstance_name\x18\x04 \x01(\t*/\n\x07Version\x12\x14\n\x10IR_VERSION_START\x10\x00\x12\x0e\n\nIR_VERSION\x10\x01') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +_VERSION = _descriptor.EnumDescriptor( + name='Version', + full_name='mind_ir.Version', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='IR_VERSION_START', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='IR_VERSION', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=4272, + serialized_end=4319, +) +_sym_db.RegisterEnumDescriptor(_VERSION) + +Version = enum_type_wrapper.EnumTypeWrapper(_VERSION) +IR_VERSION_START = 0 +IR_VERSION = 1 + + +_ATTRIBUTEPROTO_ATTRIBUTETYPE = _descriptor.EnumDescriptor( + name='AttributeType', + full_name='mind_ir.AttributeProto.AttributeType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='UNDEFINED', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FLOAT', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT8', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT8', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT16', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT16', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT32', index=6, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT64', index=7, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='STRING', index=8, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BOOL', index=9, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FLOAT16', index=10, number=10, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DOUBLE', index=11, number=11, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT32', index=12, number=12, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT64', index=13, number=13, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='COMPLEX64', index=14, number=14, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='COMPLEX128', index=15, number=15, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BFLOAT16', index=16, number=16, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TENSOR', index=17, number=17, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GRAPH', index=18, number=18, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TENSORS', index=19, number=19, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TUPLE', index=20, number=20, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='LIST', index=21, number=21, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DICT', index=22, number=22, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UMONAD', index=23, number=23, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='IOMONAD', index=24, number=24, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NONE', index=25, number=25, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PRIMITIVECLOSURE', index=26, number=26, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FUNCGRAPHCLOSURE', index=27, number=27, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PARTIALCLOSURE', index=28, number=28, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UNIONFUNCCLOSURE', index=29, number=29, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CSR_TENSOR', index=30, number=30, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='COO_TENSOR', index=31, number=31, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ROW_TENSOR', index=32, number=32, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CLASS_TYPE', index=33, number=33, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NAME_SPACE', index=34, number=34, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SYMBOL', index=35, number=35, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TYPE_NULL', index=36, number=36, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MAP_TENSOR', index=37, number=37, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FUNCTOR', index=38, number=38, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SCALAR', index=39, number=39, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=640, + serialized_end=1199, +) +_sym_db.RegisterEnumDescriptor(_ATTRIBUTEPROTO_ATTRIBUTETYPE) + +_FUNCTORPROTO_FUNCTORTYPE = _descriptor.EnumDescriptor( + name='FunctorType', + full_name='mind_ir.FunctorProto.FunctorType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='SHAPE_CALC_FUNCTOR', index=0, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=1322, + serialized_end=1359, +) +_sym_db.RegisterEnumDescriptor(_FUNCTORPROTO_FUNCTORTYPE) + +_TENSORPROTO_DATATYPE = _descriptor.EnumDescriptor( + name='DataType', + full_name='mind_ir.TensorProto.DataType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='UNDEFINED', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FLOAT', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT8', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT8', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT16', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT16', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT32', index=6, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT64', index=7, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='STRING', index=8, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BOOL', index=9, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FLOAT16', index=10, number=10, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DOUBLE', index=11, number=11, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT32', index=12, number=12, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT64', index=13, number=13, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='COMPLEX64', index=14, number=14, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='COMPLEX128', index=15, number=15, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BFLOAT16', index=16, number=16, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FLOAT64', index=17, number=17, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=3358, + serialized_end=3589, +) +_sym_db.RegisterEnumDescriptor(_TENSORPROTO_DATATYPE) + +_TENSORPROTO_COMPRESSIONTYPE = _descriptor.EnumDescriptor( + name='CompressionType', + full_name='mind_ir.TensorProto.CompressionType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='NO_COMPRESSION', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INDEXING', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SPARSE', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FSE', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BIT_PACKING', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FSE_INT', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FSE_INFER', index=6, number=6, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=3591, + serialized_end=3708, +) +_sym_db.RegisterEnumDescriptor(_TENSORPROTO_COMPRESSIONTYPE) + + +_ATTRIBUTEPROTO_SEQINFOPROTO = _descriptor.Descriptor( + name='SeqInfoProto', + full_name='mind_ir.AttributeProto.SeqInfoProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='is_dyn_len', full_name='mind_ir.AttributeProto.SeqInfoProto.is_dyn_len', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tuple_elem_item', full_name='mind_ir.AttributeProto.SeqInfoProto.tuple_elem_item', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=553, + serialized_end=637, +) + +_ATTRIBUTEPROTO = _descriptor.Descriptor( + name='AttributeProto', + full_name='mind_ir.AttributeProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='mind_ir.AttributeProto.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='f', full_name='mind_ir.AttributeProto.f', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='i', full_name='mind_ir.AttributeProto.i', index=2, + number=3, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='d', full_name='mind_ir.AttributeProto.d', index=3, + number=4, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='s', full_name='mind_ir.AttributeProto.s', index=4, + number=5, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='t', full_name='mind_ir.AttributeProto.t', index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='g', full_name='mind_ir.AttributeProto.g', index=6, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='floats', full_name='mind_ir.AttributeProto.floats', index=7, + number=8, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doubles', full_name='mind_ir.AttributeProto.doubles', index=8, + number=9, type=1, cpp_type=5, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='ints', full_name='mind_ir.AttributeProto.ints', index=9, + number=10, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='strings', full_name='mind_ir.AttributeProto.strings', index=10, + number=11, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tensors', full_name='mind_ir.AttributeProto.tensors', index=11, + number=12, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='graphs', full_name='mind_ir.AttributeProto.graphs', index=12, + number=13, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='mind_ir.AttributeProto.doc_string', index=13, + number=14, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='ref_attr_name', full_name='mind_ir.AttributeProto.ref_attr_name', index=14, + number=15, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='type', full_name='mind_ir.AttributeProto.type', index=15, + number=16, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='values', full_name='mind_ir.AttributeProto.values', index=16, + number=17, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='seq_info', full_name='mind_ir.AttributeProto.seq_info', index=17, + number=18, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='functor', full_name='mind_ir.AttributeProto.functor', index=18, + number=19, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[_ATTRIBUTEPROTO_SEQINFOPROTO, ], + enum_types=[ + _ATTRIBUTEPROTO_ATTRIBUTETYPE, + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=39, + serialized_end=1199, +) + + +_FUNCTORPROTO = _descriptor.Descriptor( + name='FunctorProto', + full_name='mind_ir.FunctorProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='type', full_name='mind_ir.FunctorProto.type', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='mind_ir.FunctorProto.name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='values', full_name='mind_ir.FunctorProto.values', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _FUNCTORPROTO_FUNCTORTYPE, + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=1202, + serialized_end=1359, +) + + +_VALUEINFOPROTO = _descriptor.Descriptor( + name='ValueInfoProto', + full_name='mind_ir.ValueInfoProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='mind_ir.ValueInfoProto.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tensor', full_name='mind_ir.ValueInfoProto.tensor', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='mind_ir.ValueInfoProto.doc_string', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='denotation', full_name='mind_ir.ValueInfoProto.denotation', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='attr_info', full_name='mind_ir.ValueInfoProto.attr_info', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=1362, + serialized_end=1514, +) + + +_NODEPROTO = _descriptor.Descriptor( + name='NodeProto', + full_name='mind_ir.NodeProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='input', full_name='mind_ir.NodeProto.input', index=0, + number=1, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='output', full_name='mind_ir.NodeProto.output', index=1, + number=2, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='mind_ir.NodeProto.name', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='op_type', full_name='mind_ir.NodeProto.op_type', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='attribute', full_name='mind_ir.NodeProto.attribute', index=4, + number=5, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='mind_ir.NodeProto.doc_string', index=5, + number=6, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='domain', full_name='mind_ir.NodeProto.domain', index=6, + number=7, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='node_attr', full_name='mind_ir.NodeProto.node_attr', index=7, + number=8, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='primal_attr', full_name='mind_ir.NodeProto.primal_attr', index=8, + number=9, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=1517, + serialized_end=1760, +) + + +_MODELPROTO = _descriptor.Descriptor( + name='ModelProto', + full_name='mind_ir.ModelProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ir_version', full_name='mind_ir.ModelProto.ir_version', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='producer_name', full_name='mind_ir.ModelProto.producer_name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='producer_version', full_name='mind_ir.ModelProto.producer_version', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='domain', full_name='mind_ir.ModelProto.domain', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='model_version', full_name='mind_ir.ModelProto.model_version', index=4, + number=5, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='mind_ir.ModelProto.doc_string', index=5, + number=6, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='graph', full_name='mind_ir.ModelProto.graph', index=6, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='functions', full_name='mind_ir.ModelProto.functions', index=7, + number=8, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='preprocessor', full_name='mind_ir.ModelProto.preprocessor', index=8, + number=9, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='little_endian', full_name='mind_ir.ModelProto.little_endian', index=9, + number=10, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='parallel', full_name='mind_ir.ModelProto.parallel', index=10, + number=11, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='primitives', full_name='mind_ir.ModelProto.primitives', index=11, + number=12, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mind_ir_version', full_name='mind_ir.ModelProto.mind_ir_version', index=12, + number=13, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=1763, + serialized_end=2164, +) + + +_PREPROCESSORPROTO = _descriptor.Descriptor( + name='PreprocessorProto', + full_name='mind_ir.PreprocessorProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='op', full_name='mind_ir.PreprocessorProto.op', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=2166, + serialized_end=2225, +) + + +_PREPROCESSOPPROTO = _descriptor.Descriptor( + name='PreprocessOpProto', + full_name='mind_ir.PreprocessOpProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='input_columns', full_name='mind_ir.PreprocessOpProto.input_columns', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='output_columns', full_name='mind_ir.PreprocessOpProto.output_columns', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='project_columns', full_name='mind_ir.PreprocessOpProto.project_columns', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='op_type', full_name='mind_ir.PreprocessOpProto.op_type', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='operations', full_name='mind_ir.PreprocessOpProto.operations', index=4, + number=5, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='offload', full_name='mind_ir.PreprocessOpProto.offload', index=5, + number=6, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=2228, + serialized_end=2373, +) + + +_GRAPHPROTO = _descriptor.Descriptor( + name='GraphProto', + full_name='mind_ir.GraphProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='node', full_name='mind_ir.GraphProto.node', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='mind_ir.GraphProto.name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='parameter', full_name='mind_ir.GraphProto.parameter', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='mind_ir.GraphProto.doc_string', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='input', full_name='mind_ir.GraphProto.input', index=4, + number=5, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='output', full_name='mind_ir.GraphProto.output', index=5, + number=6, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bprop_hash', full_name='mind_ir.GraphProto.bprop_hash', index=6, + number=7, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='attribute', full_name='mind_ir.GraphProto.attribute', index=7, + number=8, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bprop_filepath', full_name='mind_ir.GraphProto.bprop_filepath', index=8, + number=9, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='map_parameter', full_name='mind_ir.GraphProto.map_parameter', index=9, + number=10, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=2376, + serialized_end=2714, +) + + +_TENSORPROTO_EXTERNALDATAPROTO = _descriptor.Descriptor( + name='ExternalDataProto', + full_name='mind_ir.TensorProto.ExternalDataProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='location', full_name='mind_ir.TensorProto.ExternalDataProto.location', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='offset', full_name='mind_ir.TensorProto.ExternalDataProto.offset', index=1, + number=2, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='length', full_name='mind_ir.TensorProto.ExternalDataProto.length', index=2, + number=3, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='checksum', full_name='mind_ir.TensorProto.ExternalDataProto.checksum', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=3180, + serialized_end=3267, +) + +_TENSORPROTO_QUANTPARAMPROTO = _descriptor.Descriptor( + name='QuantParamProto', + full_name='mind_ir.TensorProto.QuantParamProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='quant_algo_name', full_name='mind_ir.TensorProto.QuantParamProto.quant_algo_name', index=0, + number=1, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='attribute', full_name='mind_ir.TensorProto.QuantParamProto.attribute', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=3269, + serialized_end=3355, +) + +_TENSORPROTO = _descriptor.Descriptor( + name='TensorProto', + full_name='mind_ir.TensorProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='dims', full_name='mind_ir.TensorProto.dims', index=0, + number=1, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='data_type', full_name='mind_ir.TensorProto.data_type', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='float_data', full_name='mind_ir.TensorProto.float_data', index=2, + number=3, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='int32_data', full_name='mind_ir.TensorProto.int32_data', index=3, + number=4, type=5, cpp_type=1, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='string_data', full_name='mind_ir.TensorProto.string_data', index=4, + number=5, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='int64_data', full_name='mind_ir.TensorProto.int64_data', index=5, + number=6, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='mind_ir.TensorProto.name', index=6, + number=7, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='mind_ir.TensorProto.doc_string', index=7, + number=8, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='raw_data', full_name='mind_ir.TensorProto.raw_data', index=8, + number=9, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='double_data', full_name='mind_ir.TensorProto.double_data', index=9, + number=10, type=1, cpp_type=5, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='uint64_data', full_name='mind_ir.TensorProto.uint64_data', index=10, + number=11, type=4, cpp_type=4, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='external_data', full_name='mind_ir.TensorProto.external_data', index=11, + number=12, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='ref_key', full_name='mind_ir.TensorProto.ref_key', index=12, + number=13, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='min_dims', full_name='mind_ir.TensorProto.min_dims', index=13, + number=14, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='max_dims', full_name='mind_ir.TensorProto.max_dims', index=14, + number=15, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='compression_type', full_name='mind_ir.TensorProto.compression_type', index=15, + number=16, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='quant_params', full_name='mind_ir.TensorProto.quant_params', index=16, + number=17, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[_TENSORPROTO_EXTERNALDATAPROTO, _TENSORPROTO_QUANTPARAMPROTO, ], + enum_types=[ + _TENSORPROTO_DATATYPE, + _TENSORPROTO_COMPRESSIONTYPE, + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=2717, + serialized_end=3708, +) + + +_MAPTENSORPROTO = _descriptor.Descriptor( + name='MapTensorProto', + full_name='mind_ir.MapTensorProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='mind_ir.MapTensorProto.name', index=0, + number=1, type=9, cpp_type=9, label=2, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='default_value', full_name='mind_ir.MapTensorProto.default_value', index=1, + number=2, type=11, cpp_type=10, label=2, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='key_tensor', full_name='mind_ir.MapTensorProto.key_tensor', index=2, + number=3, type=11, cpp_type=10, label=2, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='value_tensor', full_name='mind_ir.MapTensorProto.value_tensor', index=3, + number=4, type=11, cpp_type=10, label=2, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='status_tensor', full_name='mind_ir.MapTensorProto.status_tensor', index=4, + number=5, type=11, cpp_type=10, label=2, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=3711, + serialized_end=3920, +) + + +_PARALLELPROTO = _descriptor.Descriptor( + name='ParallelProto', + full_name='mind_ir.ParallelProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='layout', full_name='mind_ir.ParallelProto.layout', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=3922, + serialized_end=3975, +) + + +_LAYOUTPROTO = _descriptor.Descriptor( + name='LayoutProto', + full_name='mind_ir.LayoutProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='mind_ir.LayoutProto.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='device_arrangement_int', full_name='mind_ir.LayoutProto.device_arrangement_int', index=1, + number=2, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tensor_map_int', full_name='mind_ir.LayoutProto.tensor_map_int', index=2, + number=3, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='slice_shape_int', full_name='mind_ir.LayoutProto.slice_shape_int', index=3, + number=4, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='field_size', full_name='mind_ir.LayoutProto.field_size', index=4, + number=5, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='uniform_split', full_name='mind_ir.LayoutProto.uniform_split', index=5, + number=6, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='opt_shard_group', full_name='mind_ir.LayoutProto.opt_shard_group', index=6, + number=7, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=3978, + serialized_end=4154, +) + + +_PRIMITIVEPROTO = _descriptor.Descriptor( + name='PrimitiveProto', + full_name='mind_ir.PrimitiveProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='mind_ir.PrimitiveProto.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='op_type', full_name='mind_ir.PrimitiveProto.op_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='attribute', full_name='mind_ir.PrimitiveProto.attribute', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='instance_name', full_name='mind_ir.PrimitiveProto.instance_name', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=4156, + serialized_end=4270, +) + +_ATTRIBUTEPROTO_SEQINFOPROTO.fields_by_name['tuple_elem_item'].message_type = _ATTRIBUTEPROTO +_ATTRIBUTEPROTO_SEQINFOPROTO.containing_type = _ATTRIBUTEPROTO +_ATTRIBUTEPROTO.fields_by_name['t'].message_type = _TENSORPROTO +_ATTRIBUTEPROTO.fields_by_name['g'].message_type = _GRAPHPROTO +_ATTRIBUTEPROTO.fields_by_name['tensors'].message_type = _TENSORPROTO +_ATTRIBUTEPROTO.fields_by_name['graphs'].message_type = _GRAPHPROTO +_ATTRIBUTEPROTO.fields_by_name['type'].enum_type = _ATTRIBUTEPROTO_ATTRIBUTETYPE +_ATTRIBUTEPROTO.fields_by_name['values'].message_type = _ATTRIBUTEPROTO +_ATTRIBUTEPROTO.fields_by_name['seq_info'].message_type = _ATTRIBUTEPROTO_SEQINFOPROTO +_ATTRIBUTEPROTO.fields_by_name['functor'].message_type = _FUNCTORPROTO +_ATTRIBUTEPROTO_ATTRIBUTETYPE.containing_type = _ATTRIBUTEPROTO +_FUNCTORPROTO.fields_by_name['type'].enum_type = _FUNCTORPROTO_FUNCTORTYPE +_FUNCTORPROTO.fields_by_name['values'].message_type = _ATTRIBUTEPROTO +_FUNCTORPROTO_FUNCTORTYPE.containing_type = _FUNCTORPROTO +_VALUEINFOPROTO.fields_by_name['tensor'].message_type = _TENSORPROTO +_VALUEINFOPROTO.fields_by_name['attr_info'].message_type = _ATTRIBUTEPROTO +_NODEPROTO.fields_by_name['attribute'].message_type = _ATTRIBUTEPROTO +_NODEPROTO.fields_by_name['node_attr'].message_type = _ATTRIBUTEPROTO +_NODEPROTO.fields_by_name['primal_attr'].message_type = _ATTRIBUTEPROTO +_MODELPROTO.fields_by_name['graph'].message_type = _GRAPHPROTO +_MODELPROTO.fields_by_name['functions'].message_type = _GRAPHPROTO +_MODELPROTO.fields_by_name['preprocessor'].message_type = _PREPROCESSORPROTO +_MODELPROTO.fields_by_name['parallel'].message_type = _PARALLELPROTO +_MODELPROTO.fields_by_name['primitives'].message_type = _PRIMITIVEPROTO +_PREPROCESSORPROTO.fields_by_name['op'].message_type = _PREPROCESSOPPROTO +_GRAPHPROTO.fields_by_name['node'].message_type = _NODEPROTO +_GRAPHPROTO.fields_by_name['parameter'].message_type = _TENSORPROTO +_GRAPHPROTO.fields_by_name['input'].message_type = _VALUEINFOPROTO +_GRAPHPROTO.fields_by_name['output'].message_type = _VALUEINFOPROTO +_GRAPHPROTO.fields_by_name['attribute'].message_type = _ATTRIBUTEPROTO +_GRAPHPROTO.fields_by_name['map_parameter'].message_type = _MAPTENSORPROTO +_TENSORPROTO_EXTERNALDATAPROTO.containing_type = _TENSORPROTO +_TENSORPROTO_QUANTPARAMPROTO.fields_by_name['attribute'].message_type = _ATTRIBUTEPROTO +_TENSORPROTO_QUANTPARAMPROTO.containing_type = _TENSORPROTO +_TENSORPROTO.fields_by_name['external_data'].message_type = _TENSORPROTO_EXTERNALDATAPROTO +_TENSORPROTO.fields_by_name['compression_type'].enum_type = _TENSORPROTO_COMPRESSIONTYPE +_TENSORPROTO.fields_by_name['quant_params'].message_type = _TENSORPROTO_QUANTPARAMPROTO +_TENSORPROTO_DATATYPE.containing_type = _TENSORPROTO +_TENSORPROTO_COMPRESSIONTYPE.containing_type = _TENSORPROTO +_MAPTENSORPROTO.fields_by_name['default_value'].message_type = _ATTRIBUTEPROTO +_MAPTENSORPROTO.fields_by_name['key_tensor'].message_type = _TENSORPROTO +_MAPTENSORPROTO.fields_by_name['value_tensor'].message_type = _TENSORPROTO +_MAPTENSORPROTO.fields_by_name['status_tensor'].message_type = _TENSORPROTO +_PARALLELPROTO.fields_by_name['layout'].message_type = _LAYOUTPROTO +_PRIMITIVEPROTO.fields_by_name['attribute'].message_type = _ATTRIBUTEPROTO +DESCRIPTOR.message_types_by_name['AttributeProto'] = _ATTRIBUTEPROTO +DESCRIPTOR.message_types_by_name['FunctorProto'] = _FUNCTORPROTO +DESCRIPTOR.message_types_by_name['ValueInfoProto'] = _VALUEINFOPROTO +DESCRIPTOR.message_types_by_name['NodeProto'] = _NODEPROTO +DESCRIPTOR.message_types_by_name['ModelProto'] = _MODELPROTO +DESCRIPTOR.message_types_by_name['PreprocessorProto'] = _PREPROCESSORPROTO +DESCRIPTOR.message_types_by_name['PreprocessOpProto'] = _PREPROCESSOPPROTO +DESCRIPTOR.message_types_by_name['GraphProto'] = _GRAPHPROTO +DESCRIPTOR.message_types_by_name['TensorProto'] = _TENSORPROTO +DESCRIPTOR.message_types_by_name['MapTensorProto'] = _MAPTENSORPROTO +DESCRIPTOR.message_types_by_name['ParallelProto'] = _PARALLELPROTO +DESCRIPTOR.message_types_by_name['LayoutProto'] = _LAYOUTPROTO +DESCRIPTOR.message_types_by_name['PrimitiveProto'] = _PRIMITIVEPROTO +DESCRIPTOR.enum_types_by_name['Version'] = _VERSION + +AttributeProto = _reflection.GeneratedProtocolMessageType('AttributeProto', (_message.Message,), dict( + + SeqInfoProto = _reflection.GeneratedProtocolMessageType('SeqInfoProto', (_message.Message,), dict( + DESCRIPTOR = _ATTRIBUTEPROTO_SEQINFOPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.AttributeProto.SeqInfoProto) + )) + , + DESCRIPTOR = _ATTRIBUTEPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.AttributeProto) + )) +_sym_db.RegisterMessage(AttributeProto) +_sym_db.RegisterMessage(AttributeProto.SeqInfoProto) + +FunctorProto = _reflection.GeneratedProtocolMessageType('FunctorProto', (_message.Message,), dict( + DESCRIPTOR = _FUNCTORPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.FunctorProto) + )) +_sym_db.RegisterMessage(FunctorProto) + +ValueInfoProto = _reflection.GeneratedProtocolMessageType('ValueInfoProto', (_message.Message,), dict( + DESCRIPTOR = _VALUEINFOPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.ValueInfoProto) + )) +_sym_db.RegisterMessage(ValueInfoProto) + +NodeProto = _reflection.GeneratedProtocolMessageType('NodeProto', (_message.Message,), dict( + DESCRIPTOR = _NODEPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.NodeProto) + )) +_sym_db.RegisterMessage(NodeProto) + +ModelProto = _reflection.GeneratedProtocolMessageType('ModelProto', (_message.Message,), dict( + DESCRIPTOR = _MODELPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.ModelProto) + )) +_sym_db.RegisterMessage(ModelProto) + +PreprocessorProto = _reflection.GeneratedProtocolMessageType('PreprocessorProto', (_message.Message,), dict( + DESCRIPTOR = _PREPROCESSORPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.PreprocessorProto) + )) +_sym_db.RegisterMessage(PreprocessorProto) + +PreprocessOpProto = _reflection.GeneratedProtocolMessageType('PreprocessOpProto', (_message.Message,), dict( + DESCRIPTOR = _PREPROCESSOPPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.PreprocessOpProto) + )) +_sym_db.RegisterMessage(PreprocessOpProto) + +GraphProto = _reflection.GeneratedProtocolMessageType('GraphProto', (_message.Message,), dict( + DESCRIPTOR = _GRAPHPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.GraphProto) + )) +_sym_db.RegisterMessage(GraphProto) + +TensorProto = _reflection.GeneratedProtocolMessageType('TensorProto', (_message.Message,), dict( + + ExternalDataProto = _reflection.GeneratedProtocolMessageType('ExternalDataProto', (_message.Message,), dict( + DESCRIPTOR = _TENSORPROTO_EXTERNALDATAPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.TensorProto.ExternalDataProto) + )) + , + + QuantParamProto = _reflection.GeneratedProtocolMessageType('QuantParamProto', (_message.Message,), dict( + DESCRIPTOR = _TENSORPROTO_QUANTPARAMPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.TensorProto.QuantParamProto) + )) + , + DESCRIPTOR = _TENSORPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.TensorProto) + )) +_sym_db.RegisterMessage(TensorProto) +_sym_db.RegisterMessage(TensorProto.ExternalDataProto) +_sym_db.RegisterMessage(TensorProto.QuantParamProto) + +MapTensorProto = _reflection.GeneratedProtocolMessageType('MapTensorProto', (_message.Message,), dict( + DESCRIPTOR = _MAPTENSORPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.MapTensorProto) + )) +_sym_db.RegisterMessage(MapTensorProto) + +ParallelProto = _reflection.GeneratedProtocolMessageType('ParallelProto', (_message.Message,), dict( + DESCRIPTOR = _PARALLELPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.ParallelProto) + )) +_sym_db.RegisterMessage(ParallelProto) + +LayoutProto = _reflection.GeneratedProtocolMessageType('LayoutProto', (_message.Message,), dict( + DESCRIPTOR = _LAYOUTPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.LayoutProto) + )) +_sym_db.RegisterMessage(LayoutProto) + +PrimitiveProto = _reflection.GeneratedProtocolMessageType('PrimitiveProto', (_message.Message,), dict( + DESCRIPTOR = _PRIMITIVEPROTO, + __module__ = 'mindinsight_mind_ir_pb2' + # @@protoc_insertion_point(class_scope:mind_ir.PrimitiveProto) + )) +_sym_db.RegisterMessage(PrimitiveProto) + + +# @@protoc_insertion_point(module_scope) diff --git a/mindinsight/domain/graph/base.py b/mindinsight/domain/graph/base.py index 408cd1e5..6dd94a5b 100644 --- a/mindinsight/domain/graph/base.py +++ b/mindinsight/domain/graph/base.py @@ -561,6 +561,12 @@ class NodeTypeEnum(enum.Enum): UPDATE_STATE = 'UpdateState' +class AttributeType(enum.Enum): + """Refer to 'mind_ir_pb2.AttributeType' object""" + TENSORS='TENSORS' + TUPLE='TUPLE' + + class DebuggerSource(Source): """Source Data object""" -- Gitee From 762110e87ed135aa20d8ddefd538f101d47c3429 Mon Sep 17 00:00:00 2001 From: zhangxiaoyong2023 Date: Fri, 24 Nov 2023 19:48:02 +0800 Subject: [PATCH 2/4] solve frontend bug --- .../datavisual/data_transform/graph/msgraph.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/mindinsight/datavisual/data_transform/graph/msgraph.py b/mindinsight/datavisual/data_transform/graph/msgraph.py index a9ce4589..adc05bae 100644 --- a/mindinsight/datavisual/data_transform/graph/msgraph.py +++ b/mindinsight/datavisual/data_transform/graph/msgraph.py @@ -25,7 +25,6 @@ from mindinsight.datavisual.proto_files.mindinsight_anf_ir_pb2 import DataType from mindinsight.domain.graph.base import NodeTypeEnum, DebuggerSource, AttributeType from mindinsight.datavisual.proto_files.mindinsight_mind_ir_pb2 import _TENSORPROTO_DATATYPE - class MSGraph(Graph): """The object describes the MindSpore graph, and it is defined in the anf_ir proto file.""" def _parse_data(self, proto_data): @@ -494,7 +493,6 @@ class MSGraph(Graph): node.type=node_type if getattr(node_proto, 'source_address', None): node.stack = DebuggerSource.build_stack_from_source_address(node_proto.source_address) - self._parse_mindir_attributes(node_proto.attribute, node) self._parse_mindir_node_inputs(node_proto.input, node) node.scope = scope @@ -604,17 +602,6 @@ class MSGraph(Graph): node.add_inputs(src_name=input_proto, input_attr=input_attr) - def _parse_mindir_attributes(self, attributes, node): - """ - Parse `mind_ir_pb2.AttributeProto` object., and Filters large attribute values. - - Args: - attributes (list[mind_ir_pb2.AttributeProto]): Refer to `mind_ir_pb2.AttributeProto` object. - node (Node): Refer to `Node` object, it is used to log message and update attr. - """ - for attr in attributes: - node.add_attr({attr.name: str(attr.tensors)}) - def _parse_mindir_constant(self, cst_proto): """ Parse `mind_ir_pb2.NodeProto` object, and create a const node. -- Gitee From b438e57aa105e5be2feebaccd31dee84bfae477c Mon Sep 17 00:00:00 2001 From: zhangxiaoyong2023 Date: Fri, 15 Dec 2023 17:49:15 +0800 Subject: [PATCH 3/4] pylint1 --- .../data_transform/graph/msgraph.py | 126 ++++++++++++------ .../data_transform/ms_data_loader.py | 10 +- .../data_transform/summary_watcher.py | 6 +- mindinsight/domain/graph/base.py | 6 +- 4 files changed, 95 insertions(+), 53 deletions(-) diff --git a/mindinsight/datavisual/data_transform/graph/msgraph.py b/mindinsight/datavisual/data_transform/graph/msgraph.py index adc05bae..53439918 100644 --- a/mindinsight/datavisual/data_transform/graph/msgraph.py +++ b/mindinsight/datavisual/data_transform/graph/msgraph.py @@ -14,7 +14,6 @@ # ============================================================================ """This file is used to define the MindSpore graph.""" import re -import time from mindinsight.datavisual.common.enums import PluginNameEnum from mindinsight.datavisual.common.log import logger @@ -25,8 +24,10 @@ from mindinsight.datavisual.proto_files.mindinsight_anf_ir_pb2 import DataType from mindinsight.domain.graph.base import NodeTypeEnum, DebuggerSource, AttributeType from mindinsight.datavisual.proto_files.mindinsight_mind_ir_pb2 import _TENSORPROTO_DATATYPE + class MSGraph(Graph): """The object describes the MindSpore graph, and it is defined in the anf_ir proto file.""" + def _parse_data(self, proto_data): """ The proto data is parsed and all nodes are stored in the specified structure. @@ -434,7 +435,7 @@ class MSGraph(Graph): """ logger.info("Start to parse graph proto data.") - self._parse_mindir_op_nodes(proto_data.node,proto_data.output) + self._parse_mindir_op_nodes(proto_data.node, proto_data.output) self._parse_mindir_graph_inputs(proto_data.input) self._parse_mindir_parameter(proto_data.parameter) @@ -449,7 +450,7 @@ class MSGraph(Graph): node_protos (list[mind_ir_pb2.NodeProto]): Refer to mind_ir_pb2.NodeProto. """ logger.debug("Start to parse output from graph.") - output_names=[] + output_names = [] for output_proto in output_protos: output_names.append(output_proto.name) @@ -458,7 +459,7 @@ class MSGraph(Graph): if not node_proto.name: logger.warning("Finding a node with an empty name will not save it.") continue - if node_proto.op_type=='Constant': + if node_proto.op_type == 'Constant': self._parse_mindir_constant(node_proto) continue self._parse_mindir_op_node(topological_index, node_proto, output_names) @@ -468,7 +469,7 @@ class MSGraph(Graph): node_id = node_proto.name id_match = re.match(r"^(.*?_.*?)_", node_id) node_name = node_proto.domain - if id_match : + if id_match: graph_id = id_match.group(1) if '/' in node_name: node_name = node_name[:node_name.find('/')] + '[' + graph_id + ']' + node_name[node_name.find('/'):] @@ -477,20 +478,20 @@ class MSGraph(Graph): scope = node_name if '/' in scope: - scope=scope[:scope.rfind('/')] + scope = scope[:scope.rfind('/')] # The Graphviz plug-in that the UI USES can't handle these special characters. check_invalid_character(node_name) if node_id in output_names: - node_id=node_id[:node_id.find(':')] + node_id = node_id[:node_id.find(':')] node = Node(name=node_name, node_id=node_id, topological_index=topological_index) node.full_name = node_name node_type = node_proto.op_type - type_result=re.search(r'::(.*):',node_type) + type_result = re.search(r'::(.*):', node_type) if type_result: - node_type=type_result.group(1) - node.type=node_type + node_type = type_result.group(1) + node.type = node_type if getattr(node_proto, 'source_address', None): node.stack = DebuggerSource.build_stack_from_source_address(node_proto.source_address) self._parse_mindir_node_inputs(node_proto.input, node) @@ -515,9 +516,9 @@ class MSGraph(Graph): logger.warning("Finding a parameter with an empty name will not save it.") continue check_invalid_character(parameter.name) - para_name=parameter.name + para_name = parameter.name if ':' in para_name: - para_name=para_name[para_name.rfind(':')+1:] + para_name = para_name[para_name.rfind(':') + 1:] node = Node(name=para_name, node_id=parameter.name) node.type = NodeTypeEnum.PARAMETER.value node.output_shape = [self._get_shape_by_parse_tensor_proto(parameter)] @@ -534,50 +535,62 @@ class MSGraph(Graph): "node def name: %s", node.node_id, node.name, parameter.name) def _parse_mindir_graph_inputs(self, input_protos): - for input in input_protos: - if not input.name: + """ + Parse the inputs of mindir graph and create parameter nodes + Args: + input_protos: Refer to mind_ir_pb2.ValueInfoProto + + """ + for input_proto in input_protos: + if not input_proto.name: logger.warning("The input proto of graph is empty, will ignore.") continue - input_name=input.name + input_name = input_proto.name if ':' in input_name: - input_name=input_name[input_name.rfind(':')+1:] + input_name = input_name[input_name.rfind(':') + 1:] check_invalid_character(input_name) - node = Node(name=input_name, node_id=input.name) + node = Node(name=input_name, node_id=input_proto.name) node.type = NodeTypeEnum.PARAMETER.value - input_shapes=[] - if input.HasField('attr_info'): - node.output_data_type=self._get_data_type_name_by_value(input.attr_info,input.attr_info.type,'type') + input_shapes = [] + if input_proto.HasField('attr_info'): + node.output_data_type = self._get_data_type_name_by_value(input_proto.attr_info, input_proto.attr_info.type, 'type') node.output_shape = input_shapes node.output_nums = len(node.output_shape) attr = dict( - type=self._get_data_type_name_by_value(input.attr_info,input.attr_info.type,'type'), + type=self._get_data_type_name_by_value(input_proto.attr_info, input_proto.attr_info.type, 'type'), shape=str(input_shapes) ) node.add_attr(attr) self._cache_node(node) continue - for tensor_proto in input.tensor: - input_shape=self._get_shape_by_parse_tensor_proto(tensor_proto) - if len(input_shape)!=0: + for tensor_proto in input_proto.tensor: + input_shape = self._get_shape_by_parse_tensor_proto(tensor_proto) + if not input_shape: input_shapes.append(input_shape) - if len(input_shapes)==0: + if not input_shapes: input_shapes.append([]) node.output_shape = input_shapes node.output_nums = len(node.output_shape) - node.output_data_type = self._get_data_type_by_parse_tensor_proto(input.tensor, node) + node.output_data_type = self._get_data_type_by_parse_tensor_proto(input_proto.tensor, node) attr = dict( - type=self._get_data_type_by_parse_tensor_proto(input.tensor, node), + type=self._get_data_type_by_parse_tensor_proto(input_proto.tensor, node), shape=str(input_shapes) ) node.add_attr(attr) self._cache_node(node) logger.debug("Foreach inputs, node id: %s, node name: %s, " - "node def name: %s", input_name, input_name, input.name) - + "node def name: %s", input_name, input_name, input_proto.name) def _parse_mindir_node_inputs(self, input_protos, node): + """ + Parse the inputs of node in mindir graph + Args: + input_protos: Refer to mind_ir_pb2.NodeProto + node: Refer to `Node` object, it is used to log message and update input. + + """ for input_proto in input_protos: if not input_proto: logger.warning("The input proto of node(%s) is empty, will ignore.", node.name) @@ -624,24 +637,34 @@ class MSGraph(Graph): else: node.add_attr({cst_proto.name: str(attr)}) - node.output_shape=self._get_shape_by_parse_attr_proto(cst_proto.attribute) + node.output_shape = self._get_shape_by_parse_attr_proto(cst_proto.attribute) node.output_nums = len(node.output_shape) self._get_data_type_by_parse_attr_proto(cst_proto.attribute, node) # dim is zero - if(node.output_nums == 0): + if node.output_nums == 0: node.output_shape.append([]) self._cache_node(node) def _get_shape_by_parse_attr_proto(self, attr_proto): - shapes=[] + """ + Get shape by parsing AttributeProto. + If data type is `TENSORS`, refer to `mind_ir_pb2.TensorProto`. + If data type is `TUPLE`, recursively running. + Args: + attr_proto: refer to `mind_ir_pb2.AttributeProto`. + + Returns: list[list[TensorProto.dims], list[TensorProto.dims]]. + + """ + shapes = [] for attr in attr_proto: - if self._get_data_type_name_by_value(attr,attr.type,'type')==AttributeType.TENSORS.value: + if self._get_data_type_name_by_value(attr, attr.type, 'type') == AttributeType.TENSORS.value: for tensor in attr.tensors: shapes.append(self._get_shape_by_parse_tensor_proto(tensor)) continue - if self._get_data_type_name_by_value(attr,attr.type,'type')==AttributeType.TUPLE.value: + if self._get_data_type_name_by_value(attr, attr.type, 'type') == AttributeType.TUPLE.value: shapes.extend(self._get_shape_by_parse_attr_proto(attr.values)) else: shapes.extend([]) @@ -652,44 +675,59 @@ class MSGraph(Graph): Parse proto's `message TensorProto` to get shape information. Args: - type_proto (mind_ir_pb2.TensorProto): Refer to mind_ir_pb2.TensorProto. + type_proto (mind_ir_pb2.TensorProto): Refer to `mind_ir_pb2.TensorProto`. Returns: list, a list of shape. """ - shape=[] + shape = [] for dim in tensor_proto.dims: shape.append(dim) return shape def _get_data_type_by_parse_attr_proto(self, attr_proto, node): - data_types=[] + """ + Get data type by parse type proto object. + + The name of the AttributeType, refer to `mind_ir_pb2.AttributeProto` + If AttributeProto.type is `TENSORS` or `TUPLE`, the data name we return is `data_type[element_type, element_type]`. + + Args: + attr_proto: Refer to `mind_ir_pb2.AttributeProto`. + + Returns: + list, the data type list. + + """ + data_types = [] for attr in attr_proto: if self._get_data_type_name_by_value(attr, attr.type, 'type') == AttributeType.TENSORS.value: - elem_types=[] + elem_types = [] for tensor in attr.tensors: data_type_name = self._get_data_type_name(tensor) node.elem_types.append(data_type_name) elem_types.append(data_type_name) data_types.append(f'{AttributeType.TENSORS.value}{str(elem_types)}') if self._get_data_type_name_by_value(attr, attr.type, 'type') == AttributeType.TUPLE.value: - data_type=self._get_data_type_by_parse_attr_proto(attr.values, node) + data_type = self._get_data_type_by_parse_attr_proto(attr.values, node) data_types.append(f'{AttributeType.TUPLE.value}{str(data_type)}') - if len(data_types)>0: + if data_types: return data_types[0] - else: - return "" + + return "" def _get_data_type_by_parse_parameter(self, parameter, node): + """Get data type by parsing parameter in mindir graph, refer to `mind_ir_b2.TensorProto`.""" data_type_name = self._get_data_type_name(parameter) node.elem_types.append(data_type_name) return str([data_type_name]) def _get_data_type_by_parse_tensor_proto(self, tensor_protos, node): - data_types=[] + """Get data type by parsing `TensorProto`.""" + data_types = [] for tensor_proto in tensor_protos: - elem_type_name=self._get_data_type_name(tensor_proto) + elem_type_name = self._get_data_type_name(tensor_proto) node.elem_types.append(elem_type_name) data_types.append(elem_type_name) return str(data_types) diff --git a/mindinsight/datavisual/data_transform/ms_data_loader.py b/mindinsight/datavisual/data_transform/ms_data_loader.py index 39e41682..11c9c468 100644 --- a/mindinsight/datavisual/data_transform/ms_data_loader.py +++ b/mindinsight/datavisual/data_transform/ms_data_loader.py @@ -223,11 +223,13 @@ class _PbParser(_Parser): if not self._set_latest_file(filename): continue future = executor.submit(self._parse_pb_file, self._summary_dir, filename) + def add_tensor_event(future_value): tensor_events = future_value.result() for tensor_event in tensor_events: if tensor_event is not None: events_data.add_tensor_event(tensor_event) + if future is not None: future.add_done_callback(exception_no_raise_wrapper(add_tensor_event)) return False @@ -568,13 +570,14 @@ class _SummaryParser(_Parser): class _MindirParser(_Parser): + """This class is used to parse mindir graph file.""" def __init__(self, summary_dir): super(_MindirParser, self).__init__(summary_dir) self._latest_mtime = 0 def parse_files(self, executor, filenames, events_data): - mindir_filenames=self.filter_files(filenames) - mindir_filenames=self.sort_files(mindir_filenames) + mindir_filenames = self.filter_files(filenames) + mindir_filenames = self.sort_files(mindir_filenames) for filename in mindir_filenames: if not self._set_latest_file(filename): continue @@ -590,6 +593,7 @@ class _MindirParser(_Parser): future.add_done_callback(exception_no_raise_wrapper(add_tensor_event)) return False return True + def filter_files(self, filenames): return list(filter(lambda filename: re.search(r'\.mindir$', filename), filenames)) @@ -631,7 +635,7 @@ class _MindirParser(_Parser): except ParseError: logger.warning("The given file is not a valid mindir file, file path: %s.", file_path) return None - ret_tensor_events = build_graph_events(model_proto, filename, 0, FileHandler.file_stat(file_path).mtime,True) + ret_tensor_events = build_graph_events(model_proto, filename, 0, FileHandler.file_stat(file_path).mtime, True) logger.info("Build graph success, file path: %s.", file_path) return ret_tensor_events diff --git a/mindinsight/datavisual/data_transform/summary_watcher.py b/mindinsight/datavisual/data_transform/summary_watcher.py index 84cdee0d..1ea41655 100644 --- a/mindinsight/datavisual/data_transform/summary_watcher.py +++ b/mindinsight/datavisual/data_transform/summary_watcher.py @@ -37,7 +37,7 @@ class SummaryWatcher: SUMMARY_FILENAME_REGEX = r'summary\.(?P\d+)' PB_FILENAME_REGEX = r'\.pb$' - MINDIR_FILENAME_REGEX=r'\.mindir$' + MINDIR_FILENAME_REGEX = r'\.mindir$' PROFILER_DIRECTORY_REGEX = r'^profiler' MAX_SUMMARY_DIR_COUNT = 999 SUMMARY_PB_MINDIR_BLACKLIST = { @@ -246,7 +246,7 @@ class SummaryWatcher: """"Update the summary dict by checking file.""" summary_pattern = re.search(self.SUMMARY_FILENAME_REGEX, entry.name) pb_pattern = re.search(self.PB_FILENAME_REGEX, entry.name) - mindir_pattern=re.search(self.MINDIR_FILENAME_REGEX, entry.name) + mindir_pattern = re.search(self.MINDIR_FILENAME_REGEX, entry.name) if not self._is_valid_pattern_result(summary_pattern, pb_pattern, mindir_pattern, list_explain, entry): return True @@ -315,7 +315,7 @@ class SummaryWatcher: """Check the pattern result is valid.""" is_in_summary_pb_mindir_blacklist = self._check_by_blacklist(entry.name) is_valid_pb = pb_pattern is not None and not is_in_summary_pb_mindir_blacklist - is_valid_mindir=mindir_pattern is not None and not is_in_summary_pb_mindir_blacklist + is_valid_mindir = mindir_pattern is not None and not is_in_summary_pb_mindir_blacklist if summary_pattern is None and not is_valid_pb and not is_valid_mindir: return False if list_explain and not entry.name.endswith(EXPLAIN_SUMMARY_SUFFIX): diff --git a/mindinsight/domain/graph/base.py b/mindinsight/domain/graph/base.py index 6dd94a5b..5e5cd1e6 100644 --- a/mindinsight/domain/graph/base.py +++ b/mindinsight/domain/graph/base.py @@ -99,7 +99,7 @@ class Tensor: dump_type = DumpType.ASYNC if dump_type == DumpType.ASYNC: - file_name = file_name[file_name.find('.')+1:] + file_name = file_name[file_name.find('.') + 1:] if is_npy: regex = r'_(?P[A-Za-z0-9]+)-op(?P\d+)' \ r'\.(?P\d+)\.(?P\d+)' \ @@ -563,8 +563,8 @@ class NodeTypeEnum(enum.Enum): class AttributeType(enum.Enum): """Refer to 'mind_ir_pb2.AttributeType' object""" - TENSORS='TENSORS' - TUPLE='TUPLE' + TENSORS = 'TENSORS' + TUPLE = 'TUPLE' class DebuggerSource(Source): -- Gitee From 29be24596a5df16c614a275dda3dd54ff4495fda Mon Sep 17 00:00:00 2001 From: zhangxiaoyong2023 Date: Fri, 15 Dec 2023 18:01:47 +0800 Subject: [PATCH 4/4] pylint2 --- mindinsight/datavisual/data_transform/graph/msgraph.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mindinsight/datavisual/data_transform/graph/msgraph.py b/mindinsight/datavisual/data_transform/graph/msgraph.py index 53439918..70df298e 100644 --- a/mindinsight/datavisual/data_transform/graph/msgraph.py +++ b/mindinsight/datavisual/data_transform/graph/msgraph.py @@ -554,7 +554,8 @@ class MSGraph(Graph): input_shapes = [] if input_proto.HasField('attr_info'): - node.output_data_type = self._get_data_type_name_by_value(input_proto.attr_info, input_proto.attr_info.type, 'type') + node.output_data_type = self._get_data_type_name_by_value( + input_proto.attr_info, input_proto.attr_info.type, 'type') node.output_shape = input_shapes node.output_nums = len(node.output_shape) attr = dict( @@ -691,7 +692,8 @@ class MSGraph(Graph): Get data type by parse type proto object. The name of the AttributeType, refer to `mind_ir_pb2.AttributeProto` - If AttributeProto.type is `TENSORS` or `TUPLE`, the data name we return is `data_type[element_type, element_type]`. + If AttributeProto.type is `TENSORS` or `TUPLE`, + the data name we return is `data_type[element_type, element_type]`. Args: attr_proto: Refer to `mind_ir_pb2.AttributeProto`. -- Gitee