follow comments

avx_docs
dangqingqing 8 years ago
parent 7a8da332a1
commit d25173c024

@ -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):
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())
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)

Loading…
Cancel
Save