提交 23ba3b50 编写于 作者: J jiangjiajun

modify program

上级 c087d20e
...@@ -54,7 +54,7 @@ class PaddleLayer(object): ...@@ -54,7 +54,7 @@ class PaddleLayer(object):
self.id = str(time.time()) self.id = str(time.time())
def add_block(self, block): def add_block(self, block):
block.father_unique_id = self.unique_id block.father_layer = self
self.blocks.append(block) self.blocks.append(block)
...@@ -66,7 +66,7 @@ class PaddleProgram(object): ...@@ -66,7 +66,7 @@ class PaddleProgram(object):
self.inputs = list() self.inputs = list()
self.outputs = list() self.outputs = list()
self.parameters = dict() self.parameters = dict()
self.father_layer_id = None self.father_layer = None
def clear(self): def clear(self):
self.layers = OrderedDict() self.layers = OrderedDict()
...@@ -79,8 +79,8 @@ class PaddleProgram(object): ...@@ -79,8 +79,8 @@ class PaddleProgram(object):
def add_layer(self, kernel, inputs, outputs, **kwargs): def add_layer(self, kernel, inputs, outputs, **kwargs):
layer = PaddleLayer(kernel, inputs, outputs, **kwargs) layer = PaddleLayer(kernel, inputs, outputs, **kwargs)
layer_id = str(len(self.layers)) layer_id = str(len(self.layers))
if self.father_layer_id is not None: if self.father_layer is not None:
layer_id = "{}.{}".format(layer_id, self.father_layer_id) layer_id = "{}.{}.{}".format(layer_id, len(self.father_layer.blocks()), self.father_layer.id)
self.layers[layer_id] = layer self.layers[layer_id] = layer
return layer_id return layer_id
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册