Exemplo n.º 1
0
 def dump(self, model_output_dir):
     '''Return the file path containing graph in generated model files.'''
     if not os.path.exists(model_output_dir):
         os.makedirs(model_output_dir)
     sys.path.append(os.path.dirname(self.code_output_path))
     file_name = os.path.splitext(os.path.basename(self.code_output_path))[0]
     module = import_module(file_name)
     class_name = get_upper_case(file_name)
     net = getattr(module, class_name)
     return net.dump(self.data_output_path, model_output_dir)
Exemplo n.º 2
0
 def dump(self, model_output_dir):
     '''Return the file path containing graph in generated model files.'''
     if not os.path.exists(model_output_dir):
         os.makedirs(model_output_dir)
     sys.path.append(os.path.dirname(self.code_output_path))
     file_name = os.path.splitext(os.path.basename(
         self.code_output_path))[0]
     module = import_module(file_name)
     class_name = get_upper_case(file_name)
     net = getattr(module, class_name)
     return net.dump(self.data_output_path, model_output_dir)
Exemplo n.º 3
0
    def transform_graph(self):
        for node in self.graph.nodes:
            self.layer_name_map[node.name] = node.name

        ret = []
        for node in self.graph.nodes:
            mapped_node = self.map_node(node)
            if isinstance(mapped_node, list):
                ret.extend([n for n in mapped_node])
            else:
                ret.append(mapped_node)

        name = get_upper_case(get_lower_case(self.graph.name))
        return Graph(name, ret)
Exemplo n.º 4
0
    def transform_graph(self):
        for node in self.graph.nodes:
            self.layer_name_map[node.name] = node.name

        ret = []
        for node in self.graph.nodes:
            mapped_node = self.map_node(node)
            if isinstance(mapped_node, list):
                ret.extend([n for n in mapped_node])
            elif mapped_node:
                ret.append(mapped_node)

        name = get_upper_case(get_lower_case(self.graph.name))
        return Graph(name, ret)