提交 e0c3a6d6 编写于 作者: Q qiaolongfei

optimize parameter name

上级 0bd75a57
...@@ -35,26 +35,26 @@ def parse_network(*outputs): ...@@ -35,26 +35,26 @@ def parse_network(*outputs):
class Layer(object): class Layer(object):
def __init__(self, name, parent_layer): def __init__(self, name, parent_layers):
assert isinstance(parent_layer, dict) assert isinstance(parent_layers, dict)
assert isinstance(name, basestring) assert isinstance(name, basestring)
self.name = name self.name = name
self.__parent_layer__ = parent_layer self.__parent_layers__ = parent_layers
def to_proto(self, context): def to_proto(self, context):
""" """
function to set proto attribute function to set proto attribute
""" """
kwargs = dict() kwargs = dict()
for param_name in self.__parent_layer__: for layer_name in self.__parent_layers__:
if not isinstance(self.__parent_layer__[param_name], if not isinstance(self.__parent_layers__[layer_name],
collections.Sequence): collections.Sequence):
param_value = self.__parent_layer__[param_name].to_proto( v1_layer = self.__parent_layers__[layer_name].to_proto(
context=context) context=context)
else: else:
param_value = map(lambda x: x.to_proto(context=context), v1_layer = map(lambda x: x.to_proto(context=context),
self.__parent_layer__[param_name]) self.__parent_layers__[layer_name])
kwargs[param_name] = param_value kwargs[layer_name] = v1_layer
if self.name not in context: if self.name not in context:
context[self.name] = self.to_proto_impl(**kwargs) context[self.name] = self.to_proto_impl(**kwargs)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册