Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
720274da
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
720274da
编写于
10月 18, 2017
作者:
X
xzl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add max-pool-with-mask python interface
上级
3a68955f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
8 deletion
+21
-8
python/paddle/trainer/config_parser.py
python/paddle/trainer/config_parser.py
+3
-3
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+3
-3
python/paddle/trainer_config_helpers/poolings.py
python/paddle/trainer_config_helpers/poolings.py
+15
-2
未找到文件。
python/paddle/trainer/config_parser.py
浏览文件 @
720274da
...
@@ -1250,9 +1250,9 @@ def parse_bilinear(bilinear, input_layer_name, bilinear_conf):
...
@@ -1250,9 +1250,9 @@ def parse_bilinear(bilinear, input_layer_name, bilinear_conf):
def
parse_pool
(
pool
,
input_layer_name
,
pool_conf
,
ceil_mode
):
def
parse_pool
(
pool
,
input_layer_name
,
pool_conf
,
ceil_mode
):
pool_conf
.
pool_type
=
pool
.
pool_type
pool_conf
.
pool_type
=
pool
.
pool_type
config_assert
(
pool
.
pool_type
in
[
config_assert
(
pool
.
pool_type
in
[
'max-projection'
,
'avg-projection'
,
'cudnn-max-pool'
,
'cudnn-avg-pool'
'max-projection'
,
'avg-projection'
,
'
max-pool-with-mask'
,
'
cudnn-max-pool'
,
'cudnn-avg-pool'
],
"pool-type %s is not in "
],
"pool-type %s is not in "
\
"['max-projection', 'avg-projection', "
"['max-projection', 'avg-projection', 'max-pool-with-mask',"
\
"'cudnn-max-pool', 'cudnn-avg-pool']"
%
pool
.
pool_type
)
"'cudnn-max-pool', 'cudnn-avg-pool']"
%
pool
.
pool_type
)
pool_conf
.
channels
=
pool
.
channels
pool_conf
.
channels
=
pool
.
channels
...
...
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
720274da
...
@@ -20,7 +20,7 @@ from paddle.trainer.config_parser import *
...
@@ -20,7 +20,7 @@ from paddle.trainer.config_parser import *
from
.activations
import
LinearActivation
,
SigmoidActivation
,
TanhActivation
,
\
from
.activations
import
LinearActivation
,
SigmoidActivation
,
TanhActivation
,
\
ReluActivation
,
IdentityActivation
,
SoftmaxActivation
,
BaseActivation
ReluActivation
,
IdentityActivation
,
SoftmaxActivation
,
BaseActivation
from
.evaluators
import
*
from
.evaluators
import
*
from
.poolings
import
MaxPooling
,
AvgPooling
,
BasePoolingType
,
\
from
.poolings
import
MaxPooling
,
AvgPooling
,
MaxWithMaskPooling
,
BasePoolingType
,
\
CudnnAvgPooling
,
CudnnMaxPooling
CudnnAvgPooling
,
CudnnMaxPooling
from
.attrs
import
*
from
.attrs
import
*
from
.default_decorators
import
*
from
.default_decorators
import
*
...
@@ -2652,9 +2652,9 @@ def img_pool_layer(input,
...
@@ -2652,9 +2652,9 @@ def img_pool_layer(input,
elif
isinstance
(
pool_type
,
AvgPooling
):
elif
isinstance
(
pool_type
,
AvgPooling
):
pool_type
.
name
=
'avg'
pool_type
.
name
=
'avg'
assert
type
(
pool_type
)
in
[
AvgPooling
,
MaxPooling
,
CudnnAvgPooling
,
assert
type
(
pool_type
)
in
[
AvgPooling
,
MaxPooling
,
MaxWithMaskPooling
,
CudnnAvgPooling
,
CudnnMaxPooling
],
\
CudnnMaxPooling
],
\
"only (Cudnn)AvgPooling, (Cudnn)MaxPooling are supported"
"only (Cudnn)AvgPooling, (Cudnn)MaxPooling
MaxWithMaskPooling
are supported"
type_name
=
pool_type
.
name
+
'-projection'
\
type_name
=
pool_type
.
name
+
'-projection'
\
if
(
if
(
...
...
python/paddle/trainer_config_helpers/poolings.py
浏览文件 @
720274da
...
@@ -15,8 +15,8 @@
...
@@ -15,8 +15,8 @@
"""
"""
__all__
=
[
__all__
=
[
"BasePoolingType"
,
"MaxPooling"
,
"AvgPooling"
,
"
CudnnMax
Pooling"
,
"BasePoolingType"
,
"MaxPooling"
,
"AvgPooling"
,
"
MaxWithMask
Pooling"
,
"CudnnAvgPooling"
,
"SumPooling"
,
"SquareRootNPooling"
"Cudnn
MaxPooling"
,
"Cudnn
AvgPooling"
,
"SumPooling"
,
"SquareRootNPooling"
]
]
...
@@ -55,6 +55,19 @@ class MaxPooling(BasePoolingType):
...
@@ -55,6 +55,19 @@ class MaxPooling(BasePoolingType):
self
.
output_max_index
=
output_max_index
self
.
output_max_index
=
output_max_index
class
MaxWithMaskPooling
(
BasePoolingType
):
"""
MaxWithMask pooling.
Not only return the very large values for each dimension in sequence or time steps,
but also the location indices of found maxinum values.
"""
def
__init__
(
self
):
BasePoolingType
.
__init__
(
self
,
"max-pool-with-mask"
)
class
CudnnMaxPooling
(
BasePoolingType
):
class
CudnnMaxPooling
(
BasePoolingType
):
"""
"""
Cudnn max pooling only support GPU. Return the maxinum value in the
Cudnn max pooling only support GPU. Return the maxinum value in the
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录