From 4ca9c3955ebaf239053ab0e1da011518e92fabf8 Mon Sep 17 00:00:00 2001 From: dangqingqing Date: Fri, 18 Nov 2016 18:31:09 +0800 Subject: [PATCH] minor changes --- proto/ModelConfig.proto.m4 | 12 ++++++------ python/paddle/trainer/config_parser.py | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/proto/ModelConfig.proto.m4 b/proto/ModelConfig.proto.m4 index aea77248cb..c835cfd522 100644 --- a/proto/ModelConfig.proto.m4 +++ b/proto/ModelConfig.proto.m4 @@ -92,7 +92,7 @@ message PoolConfig { optional uint32 start = 4; // Defines the stride size between successive pooling squares. - required uint32 stride = 5; + required uint32 stride = 5 [default = 1]; // The size of output feature map. required uint32 output_x = 6; @@ -105,19 +105,19 @@ message PoolConfig { optional uint32 padding = 8 [default = 0]; // if not set, use size_x - optional uint32 size_y = 9 [default = 0]; + optional uint32 size_y = 9; // if not set, use stride - optional uint32 stride_y = 10 [default = 0]; + optional uint32 stride_y = 10; // if not set, use output_x - optional uint32 output_y = 11 [default = 0]; + optional uint32 output_y = 11; // if not set, use img_size - optional uint32 img_size_y = 12 [default = 0]; + optional uint32 img_size_y = 12; // if not set, use padding - optional uint32 padding_y = 13 [default = 0]; + optional uint32 padding_y = 13; } message SppConfig { diff --git a/python/paddle/trainer/config_parser.py b/python/paddle/trainer/config_parser.py index adcd14569e..427d690786 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=1, + stride=None, # 1 by defalut in protobuf stride_y=None, - padding=0, + padding=None, # 0 by defalut in protobuf padding_y=None): self.add_keys(locals()) @@ -1111,9 +1111,9 @@ def parse_pool(pool, input_layer_name, pool_conf): config_assert(not pool.start, "start is deprecated in pooling.") - pool_conf.padding = pool.padding + 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) -- GitLab