From 1d1a04c033e9a63690b39be2573de4747c51f156 Mon Sep 17 00:00:00 2001
From: Luo Tao <luotao02@baidu.com>
Date: Wed, 30 Nov 2016 13:52:48 +0800
Subject: [PATCH] follow comments on rectangle CNN

---
 paddle/gserver/layers/DataLayer.cpp    | 9 +++++++--
 python/paddle/trainer/config_parser.py | 7 +++----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/paddle/gserver/layers/DataLayer.cpp b/paddle/gserver/layers/DataLayer.cpp
index f6f4bf1d9c..67c4923036 100644
--- a/paddle/gserver/layers/DataLayer.cpp
+++ b/paddle/gserver/layers/DataLayer.cpp
@@ -49,8 +49,13 @@ void DataLayer::copyDataToOutput(Argument& output) {
       output.ids->copyFrom(*data_.ids);
     }
   }
-  output.setFrameHeight(config_.height());
-  output.setFrameWidth(config_.width());
+  if (config_.height() && config_.width()) {
+    output.setFrameHeight(config_.height());
+    output.setFrameWidth(config_.width());
+  } else {
+    output.setFrameHeight(data_.getFrameHeight());
+    output.setFrameHeight(data_.getFrameHeight());
+  }
   output.cpuSequenceDims = data_.cpuSequenceDims;
   output.sequenceStartPositions = data_.sequenceStartPositions;
   output.subSequenceStartPositions = data_.subSequenceStartPositions;
diff --git a/python/paddle/trainer/config_parser.py b/python/paddle/trainer/config_parser.py
index f917ead680..0f4839e831 100644
--- a/python/paddle/trainer/config_parser.py
+++ b/python/paddle/trainer/config_parser.py
@@ -1931,10 +1931,9 @@ class MaxOutLayer(LayerBase):
         input_layer = self.get_input_layer(0)
         maxout_conf = self.config.inputs[0].maxout_conf
         parse_maxout(self.inputs[0].maxout, input_layer.name, maxout_conf)
-        self.set_layer_size(g_layer_map[input_layer.name].size /
-                            maxout_conf.groups)
-        self.set_layer_height_width(g_layer_map[input_layer.name].height,
-                                    g_layer_map[input_layer.name].width)
+        out_channels = maxout_conf.image_conf.channels / maxout_conf.groups
+        self.set_cnn_layer(name, g_layer_map[input_layer.name].height,
+                           g_layer_map[input_layer.name].width, out_channels)
 
 
 # key: cost type
-- 
GitLab