From d6cc5203badafd0c18da9d7fe620a9bfc9c00a3e Mon Sep 17 00:00:00 2001 From: emailweixu Date: Tue, 13 Sep 2016 02:41:30 -0700 Subject: [PATCH] Fix LayerOutput.parents for some layers and mixed_layer for Operator (#69) --- python/paddle/trainer_config_helpers/layers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/paddle/trainer_config_helpers/layers.py b/python/paddle/trainer_config_helpers/layers.py index b7e5f566bb8..bbd8891ce69 100644 --- a/python/paddle/trainer_config_helpers/layers.py +++ b/python/paddle/trainer_config_helpers/layers.py @@ -171,6 +171,8 @@ class LayerOutput(object): assert LayerType.is_layer_type(layer_type) self.name = name self.layer_type = layer_type + if parents is not None and type(parents) != list: + parents = [parents] self.parents = [] if parents is None else parents self.activation = activation self.num_filters = num_filters @@ -512,7 +514,7 @@ class MixedLayerType(LayerOutput): :rtype: MixedLayerType """ if not self.finalized: - assert isinstance(other, Projection) + assert isinstance(other, Projection) or isinstance(other, Operator) self.inputs.append(other) self.parents.append(other.origin) return self -- GitLab