Esempio n. 1
0
    def _dump_node(self, node: fbs.Node):
        optype = node.OpType().decode()
        domain = node.Domain().decode(
        ) or 'ai.onnx'  # empty domain defaults to ai.onnx

        inputs = [
            node.Inputs(i).decode() for i in range(0, node.InputsLength())
        ]
        outputs = [
            node.Outputs(i).decode() for i in range(0, node.OutputsLength())
        ]
        print(f'{node.Index()}:{node.Name().decode()}({domain}:{optype}) '
              f'inputs=[{",".join(inputs)} outputs=[{",".join(outputs)}]')
    def process_node(self, node: fbs.Node, value_name_to_typeinfo: dict):
        '''
        Process a Node and record info on the types used.
        :param node: Node from ORT format model
        :param value_name_to_typeinfo: Map of value names to TypeInfo instances
        '''
        optype = node.OpType().decode()
        domain = node.Domain().decode(
        ) or 'ai.onnx'  # empty domain defaults to ai.onnx

        key = _create_op_key(domain, optype)
        op_processor = self._get_op_processor(key)
        if op_processor:
            op_processor.process_node(node, value_name_to_typeinfo)