From 4cb2966d7b60895d33fb9c951c3707b80c891174 Mon Sep 17 00:00:00 2001 From: chengduoZH Date: Tue, 5 Sep 2017 19:16:59 +0800 Subject: [PATCH] fix config_parser.py(concat_layer and addto_layer) --- python/paddle/trainer/config_parser.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/python/paddle/trainer/config_parser.py b/python/paddle/trainer/config_parser.py index b6ae11147fc..ffd31f48f9a 100644 --- a/python/paddle/trainer/config_parser.py +++ b/python/paddle/trainer/config_parser.py @@ -2737,14 +2737,13 @@ class AddToLayer(LayerBase): config_assert(len(inputs) > 0, 'inputs cannot be empty for AddToLayer') if len(self.inputs) > 1: - assert len(self.inputs) == 2 - assert self.get_input_layer(0).size == self.get_input_layer(1).size - assert self.get_input_layer(0).depth == self.get_input_layer( - 1).depth - assert self.get_input_layer(0).height == self.get_input_layer( - 1).height - assert self.get_input_layer(0).width == self.get_input_layer( - 1).width + for input_index in xrange(len(self.inputs)): + assert self.get_input_layer(0).height == self.get_input_layer( + input_index).height + assert self.get_input_layer(0).width == self.get_input_layer( + input_index).width + assert self.get_input_layer(0).depth == self.get_input_layer( + input_index).depth self.set_layer_size(self.get_input_layer(0).size) self.set_layer_height_width(self.get_input_layer(0).height, \ @@ -3429,6 +3428,12 @@ class ConcatenateLayer(LayerBase): name, 'concat', 0, inputs=inputs, **xargs) size = 0 for input_index in xrange(len(self.inputs)): + assert self.get_input_layer(0).height == self.get_input_layer( + input_index).height + assert self.get_input_layer(0).width == self.get_input_layer( + input_index).width + assert self.get_input_layer(0).depth == self.get_input_layer( + input_index).depth input_layer = self.get_input_layer(input_index) input = self.inputs[input_index] if self.config.size == 0: -- GitLab