示例#1
0
    def __init__(self):
        #图的中间表示:根据src_graph, 统一使用GraphDef,来构造图的中间表示并生成.pb. 然后在具体的Emitter中使用这个中间表示(通过IRGraph包裹),来生成其它指定框架的代码和权重文件.
        self.IR_graph = GraphDef()  #GraphDef的构造过程(.node.add()),见于具体的parser子类实现
        self.weight_loaded = False

        # name --> (weight_name --> ndarray)
        self.nodes_weights = dict()  #权重的中间表示:以dict为元素的dict
示例#2
0
 def as_graph_def(self):
     graph_pb2 = GraphDef()
     graph_pb2.version = self.version
     graph_pb2.node.extend([node.node_pb2 for node in self.node_dict.values()])
     return graph_pb2
示例#3
0
    def __init__(self):
        self.IR_graph = GraphDef()
        self.weight_loaded = False

        # name --> (weight_name --> ndarray)
        self.weights = dict()