提交 e1358945 编写于 作者: G guosheng

Refine AvgPooling with excludeMode to make it compatible with the raw prototxt

上级 6b18b3cc
......@@ -140,7 +140,7 @@ message PoolConfig {
optional uint32 img_size_z = 17 [ default = 1 ];
optional uint32 padding_z = 18 [ default = 1 ];
optional bool exclude_mode = 19 [ default = true ];
optional bool exclude_mode = 19;
}
message SppConfig {
......
......@@ -1262,8 +1262,8 @@ def parse_pool(pool, input_layer_name, pool_conf, ceil_mode, exclude_mode):
pool_conf.output_y = cnn_output_size(pool_conf.img_size_y, pool_conf.size_y,
pool_conf.padding_y,
pool_conf.stride_y, not ceil_mode)
pool_conf.exclude_mode = exclude_mode
if exclude_mode != None:
pool_conf.exclude_mode = exclude_mode
def parse_pool3d(pool, input_layer_name, pool_conf, ceil_mode):
......@@ -2305,7 +2305,7 @@ class NormLayer(LayerBase):
class PoolLayer(LayerBase):
layer_type = 'pool'
def __init__(self, name, inputs, ceil_mode=True, exclude_mode=True,
def __init__(self, name, inputs, ceil_mode=True, exclude_mode=None,
**xargs):
use_mkldnn = int(g_command_config_args.get("use_mkldnn", 0))
if self.layer_type == "mkldnn_pool":
......
......@@ -2710,7 +2710,7 @@ def img_pool_layer(input,
stride_y=None,
padding_y=None,
ceil_mode=True,
exclude_mode=True):
exclude_mode=None):
"""
Image pooling Layer.
......@@ -2779,8 +2779,9 @@ def img_pool_layer(input,
be used.
:type ceil_mode: bool
:param exclude_mode: Whether to exclude the padding cells when calculating, but only
work when pool_type is AvgPooling. If use cudnn, use CudnnAvgPooling
or CudnnAvgInclPadPooling as pool_type to identify.
work when pool_type is AvgPooling. If None, also exclude the padding
cells. If use cudnn, use CudnnAvgPooling or CudnnAvgInclPadPooling
as pool_type to identify the mode.
:type exclude_mode: bool
:return: LayerOutput object.
:rtype: LayerOutput
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册