提交 d25173c0 编写于 作者: D dangqingqing

follow comments

上级 7a8da332
...@@ -134,9 +134,9 @@ class Layer(object): ...@@ -134,9 +134,9 @@ class Layer(object):
if self.name is None: if self.name is None:
return self.to_proto_impl(**kwargs) return self.to_proto_impl(**kwargs)
elif 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)
return context[self.name] return context[self.name]
def to_proto_impl(self, **kwargs): def to_proto_impl(self, **kwargs):
...@@ -161,7 +161,7 @@ def __convert_to_v2__(method_name, name_prefix=None, parent_names=None): ...@@ -161,7 +161,7 @@ def __convert_to_v2__(method_name, name_prefix=None, parent_names=None):
if key not in parent_names: if key not in parent_names:
other_kwargs[key] = kwargs[key] other_kwargs[key] = kwargs[key]
name = kwargs['name'] if kwargs.has_key('name') else None name = kwargs.get('name', None)
super(V2LayerImpl, self).__init__(name, parent_layers) super(V2LayerImpl, self).__init__(name, parent_layers)
self.__other_kwargs__ = other_kwargs self.__other_kwargs__ = other_kwargs
......
...@@ -32,7 +32,7 @@ inference = layer.fc(input=hidden, size=10, act=activation.Softmax()) ...@@ -32,7 +32,7 @@ inference = layer.fc(input=hidden, size=10, act=activation.Softmax())
class CostLayerTest(unittest.TestCase): class CostLayerTest(unittest.TestCase):
def not_test_cost_layer(self): def test_cost_layer(self):
cost1 = layer.classification_cost(input=inference, label=label) cost1 = layer.classification_cost(input=inference, label=label)
cost2 = layer.classification_cost( cost2 = layer.classification_cost(
input=inference, label=label, weight=weight) input=inference, label=label, weight=weight)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册