From 52be2a2a86f4f1cd74dc12a989341f699c67b9ed Mon Sep 17 00:00:00 2001 From: wanghaoshuang Date: Fri, 24 Nov 2017 15:41:04 +0800 Subject: [PATCH] Add depth dim --- python/paddle/trainer/config_parser.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/python/paddle/trainer/config_parser.py b/python/paddle/trainer/config_parser.py index 951019457..b342a90fb 100644 --- a/python/paddle/trainer/config_parser.py +++ b/python/paddle/trainer/config_parser.py @@ -3865,9 +3865,18 @@ class SwitchOrderLayer(LayerBase): else: inH = input_layer.height inW = input_layer.width - inC = input_layer.size / inH / inW - out_dims = [0, inH, inW, inC] - size = reduce(lambda x, y: x * y, out_dims[reshape['width'][0]:]) + if input_layer.has_depth(): + inD = input_layer.depth + inC = input_layer.size / inH / inW / inD + out_dims = [0, inD, inH, inW, inC] + size = reduce(lambda x, y: x * y, + out_dims[reshape['width'][0]:]) + else: + inC = input_layer.size / inH / inW + out_dims = [0, inH, inW, inC] + size = reduce(lambda x, y: x * y, + out_dims[reshape['width'][0]:]) + self.set_layer_size(size) -- GitLab