提交 6b199367 编写于 作者: Q qiaolongfei

handle memory layer

上级 fd3be087
......@@ -133,6 +133,10 @@ class Layer(object):
return self.to_proto_impl(**kwargs)
elif self.context_name() not in context:
context[self.context_name()] = self.to_proto_impl(**kwargs)
if self.use_context_name():
return context[self.context_name()]
else:
return context[self.name]
def to_proto_impl(self, **kwargs):
......@@ -146,6 +150,9 @@ class Layer(object):
"""
return self.name
def use_context_name(self):
return False
def __convert_to_v2__(method_name, parent_names, is_default_name=True):
if is_default_name:
......@@ -239,6 +246,13 @@ class MemoryV2(Layer):
def context_name(self):
return self.name + "#memory"
def use_context_name(self):
"""
memory layer will have the same name with some layer
:return:
"""
return True
class LayerOutputV2(Layer):
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册