Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
138f48ae
提交
138f48ae
authored
10月 13, 2016
作者:
Frédéric Bastien
提交者:
GitHub
10月 13, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5090 from nouiz/fix_pool_shape_regression
Regression FIX
上级
aac38eea
941e3a27
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
pool.py
theano/tensor/signal/pool.py
+6
-10
test_pool.py
theano/tensor/signal/tests/test_pool.py
+4
-0
没有找到文件。
theano/tensor/signal/pool.py
浏览文件 @
138f48ae
...
@@ -170,9 +170,7 @@ class Pool(OpenMPOp):
...
@@ -170,9 +170,7 @@ class Pool(OpenMPOp):
'average_exc_pad' include it)
'average_exc_pad' include it)
ndim : int
ndim : int
The number of pooling dimensions N.
The number of pooling dimensions N.
If this number is not specified, the default is set to the
If this number is not specified, the default is set to 2.
(input.ndim - 2), assuming that the first two dimensions of the input
are non-pooling dimensions.
"""
"""
...
@@ -206,9 +204,7 @@ class Pool(OpenMPOp):
...
@@ -206,9 +204,7 @@ class Pool(OpenMPOp):
right margins. No padding is added if padding is None.
right margins. No padding is added if padding is None.
ndim : int
ndim : int
The number of pooling dimensions N.
The number of pooling dimensions N.
If this number is not specified, the default is set to the
If this number is not specified, the default is set to 2.
(input.ndim - 2), assuming that the first two dimensions of the input
are non-pooling dimensions.
Returns
Returns
-------
-------
...
@@ -219,8 +215,8 @@ class Pool(OpenMPOp):
...
@@ -219,8 +215,8 @@ class Pool(OpenMPOp):
"""
"""
if
ndim
is
None
:
if
ndim
is
None
:
ndim
=
len
(
imgshape
)
-
2
ndim
=
2
assert
ndim
>
0
if
len
(
imgshape
)
<
ndim
:
if
len
(
imgshape
)
<
ndim
:
raise
TypeError
(
'imgshape must have at least {} dimensions'
.
format
(
ndim
))
raise
TypeError
(
'imgshape must have at least {} dimensions'
.
format
(
ndim
))
...
@@ -259,6 +255,8 @@ class Pool(OpenMPOp):
...
@@ -259,6 +255,8 @@ class Pool(OpenMPOp):
def
__init__
(
self
,
ignore_border
=
False
,
mode
=
'max'
,
ndim
=
None
,
openmp
=
None
):
def
__init__
(
self
,
ignore_border
=
False
,
mode
=
'max'
,
ndim
=
None
,
openmp
=
None
):
super
(
Pool
,
self
)
.
__init__
(
openmp
=
openmp
)
super
(
Pool
,
self
)
.
__init__
(
openmp
=
openmp
)
if
ndim
is
None
:
ndim
=
2
self
.
ndim
=
ndim
self
.
ndim
=
ndim
self
.
ignore_border
=
ignore_border
self
.
ignore_border
=
ignore_border
if
mode
not
in
[
'max'
,
'average_inc_pad'
,
'average_exc_pad'
,
'sum'
]:
if
mode
not
in
[
'max'
,
'average_inc_pad'
,
'average_exc_pad'
,
'sum'
]:
...
@@ -301,8 +299,6 @@ class Pool(OpenMPOp):
...
@@ -301,8 +299,6 @@ class Pool(OpenMPOp):
# TODO: consider restricting the dtype?
# TODO: consider restricting the dtype?
x
=
tensor
.
as_tensor_variable
(
x
)
x
=
tensor
.
as_tensor_variable
(
x
)
nd
=
self
.
ndim
nd
=
self
.
ndim
if
nd
is
None
:
nd
=
x
.
type
.
ndim
-
2
if
stride
is
None
:
if
stride
is
None
:
stride
=
ws
stride
=
ws
if
pad
is
None
:
if
pad
is
None
:
...
...
theano/tensor/signal/tests/test_pool.py
浏览文件 @
138f48ae
...
@@ -25,6 +25,10 @@ from theano import function
...
@@ -25,6 +25,10 @@ from theano import function
class
TestDownsampleFactorMax
(
utt
.
InferShapeTester
):
class
TestDownsampleFactorMax
(
utt
.
InferShapeTester
):
def
test_out_shape
(
self
):
assert
Pool
.
out_shape
((
9
,
8
,
6
),
(
2
,
2
))
==
[
9
,
4
,
3
]
assert
Pool
.
out_shape
((
8
,
6
),
(
2
,
2
))
==
[
4
,
3
]
@staticmethod
@staticmethod
def
numpy_max_pool_2d
(
input
,
ds
,
ignore_border
=
False
,
mode
=
'max'
):
def
numpy_max_pool_2d
(
input
,
ds
,
ignore_border
=
False
,
mode
=
'max'
):
'''Helper function, implementing pool_2d in pure numpy'''
'''Helper function, implementing pool_2d in pure numpy'''
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论