예제 #1
0
    def _get_inout(self):
        input_features = []
        output_features = []
        for input_node in self.IR_graph.input_layers:
            shape = shape_to_list(self.IR_graph.get_node(input_node).get_attr('shape'))
            shape = _infer_coreml_input_shape(shape)
            input_features.append((str(input_node), shape))
            print("CoreML Model Input Layer: [{}] {}".format(input_node, shape))

        for output_node in self.IR_graph.output_layers:
            node = self.IR_graph.get_node(output_node)
            node.out_edges.append(node.name)
            shape = node.get_attr('_output_shapes')
            if shape:
                shape = shape_to_list(shape[0])
            else:
                shape = [1]


            if shape == []:
                pre_output_node = self.IR_graph.get_node(node.in_edges[0])
                pre_output_node.out_edges.append(pre_output_node.name)
                shape = pre_output_node.get_attr('_output_shapes')
                shape = shape_to_list(shape[0])
            # else:
            shape = _infer_coreml_input_shape(shape)


            output_features.append((str(node.in_edges[0]), shape))
            print("CoreML Model Output Layer: [{}] {}".format(output_node, shape))

        return list(input_features), list(output_features)
예제 #2
0
    def _get_inout(self):
        input_features = []
        output_features = []
        for input_node in self.IR_graph.input_layers:
            shape = shape_to_list(self.IR_graph.get_node(input_node).get_attr('shape'))
            shape = _infer_coreml_input_shape(shape)
            input_features.append((input_node.encode(), shape))
            print("CoreML Model Input Layer: [{}] {}".format(input_node, shape))

        for output_node in self.IR_graph.output_layers:
            node = self.IR_graph.get_node(output_node)
            node.out_edges.append(node.name)
            shape = node.get_attr('_output_shapes')
            if shape:
                shape = shape_to_list(shape[0])
            else:
                shape = [1]


            if shape == []:
                pre_output_node = self.IR_graph.get_node(node.in_edges[0])
                pre_output_node.out_edges.append(pre_output_node.name)
                shape = pre_output_node.get_attr('_output_shapes')
                shape = shape_to_list(shape[0])
            # else:
            shape = _infer_coreml_input_shape(shape)


            output_features.append((node.in_edges[0].encode(), shape))
            print("CoreML Model Output Layer: [{}] {}".format(output_node, shape))

        return list(input_features), list(output_features)
예제 #3
0
    def _get_inout(self):
        input_features = []
        output_features = []
        for input_node in self.IR_graph.input_layers:
            if self.IR_graph.get_node(input_node).type == 'Const':
                continue
            shape = shape_to_list(
                self.IR_graph.get_node(input_node).get_attr('shape'))
            shape = _infer_coreml_input_shape(shape)
            input_features.append((str(input_node), shape))
            print("CoreML Model Input Layer: [{}] {}".format(
                input_node, shape))

        for output_node in self.IR_graph.output_layers:

            node = self.IR_graph.get_node(output_node)

            if node.type == 'Pack':
                continue

            node.out_edges.append(node.name)
            shape = node.get_attr('_output_shapes')
            if shape:
                shape = shape_to_list(shape[0])
            else:
                shape = [1]

            shape = _infer_coreml_input_shape(shape)

            output_features.append((str(output_node), shape))

            print("CoreML Model Output Layer: [{}] {}".format(
                output_node, shape))

        return list(input_features), list(output_features)