From 876fa1935d6950b9cfe380985906d5e7251c053d Mon Sep 17 00:00:00 2001 From: dangqingqing Date: Fri, 18 Nov 2016 14:33:49 +0800 Subject: [PATCH] Fix the config_parse.py if user does not set padding in the old config. --- python/paddle/trainer/config_parser.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/python/paddle/trainer/config_parser.py b/python/paddle/trainer/config_parser.py index dbe2f3b2927..adcd14569e5 100644 --- a/python/paddle/trainer/config_parser.py +++ b/python/paddle/trainer/config_parser.py @@ -815,9 +815,9 @@ class Pool(Cfg): size_y=None, img_width=None, start=None, - stride=None, + stride=1, stride_y=None, - padding=None, + padding=0, padding_y=None): self.add_keys(locals()) @@ -1111,15 +1111,15 @@ def parse_pool(pool, input_layer_name, pool_conf): config_assert(not pool.start, "start is deprecated in pooling.") - if pool.padding is not None: - pool_conf.padding = pool.padding - pool_conf.padding_y = default(pool.padding_y, pool_conf.padding) - pool_conf.output_x = cnn_output_size( - pool_conf.img_size, pool_conf.size_x, pool_conf.padding, - pool_conf.stride, False) - pool_conf.output_y = cnn_output_size( - pool_conf.img_size_y, pool_conf.size_y, pool_conf.padding_y, - pool_conf.stride_y, False) + pool_conf.padding = pool.padding + pool_conf.padding_y = default(pool.padding_y, pool_conf.padding) + + pool_conf.output_x = cnn_output_size( + pool_conf.img_size, pool_conf.size_x, pool_conf.padding, + pool_conf.stride, False) + pool_conf.output_y = cnn_output_size( + pool_conf.img_size_y, pool_conf.size_y, pool_conf.padding_y, + pool_conf.stride_y, False) def parse_spp(spp, input_layer_name, spp_conf): -- GitLab