Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
53e556fc
提交
53e556fc
authored
6月 17, 2014
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1891 from nouiz/signal_conv2d
Interface change: Make theano.tensor.signal.conv2d(2d,2d) output 2d answer.
上级
b53ab5f5
3f7d0389
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
37 行增加
和
11 行删除
+37
-11
NEWS_DEV.txt
NEWS_DEV.txt
+3
-0
configdefaults.py
theano/configdefaults.py
+6
-0
test_driver.py
theano/sandbox/cuda/tests/test_driver.py
+9
-5
conv.py
theano/tensor/signal/conv.py
+13
-1
test_conv.py
theano/tensor/signal/tests/test_conv.py
+6
-5
没有找到文件。
NEWS_DEV.txt
浏览文件 @
53e556fc
...
...
@@ -13,6 +13,9 @@ Done up to PR 1608
* https://github.com/Theano/Theano/pull/1591 # need info
Interface change:
- theano.tensor.signal.conv2d(2d,2d) output 2d answer. (Frederic B., reported by Alexander Izvorski)
Theano Development version
==========================
...
...
theano/configdefaults.py
浏览文件 @
53e556fc
...
...
@@ -400,6 +400,12 @@ AddConfigVar('warn.vm_gc_bug',
BoolParam
(
False
),
in_c_key
=
False
)
AddConfigVar
(
'warn.signal_conv2d_interface'
,
(
"Warn we use the new signal.conv2d() when its interface"
" changed mid June 2014"
),
BoolParam
(
warn_default
(
'0.7'
)),
in_c_key
=
False
)
AddConfigVar
(
'compute_test_value'
,
(
"If 'True', Theano will run each op at graph build time, using "
"Constants, SharedVariables and the tag 'test_value' as inputs "
...
...
theano/sandbox/cuda/tests/test_driver.py
浏览文件 @
53e556fc
...
...
@@ -2,11 +2,15 @@ import numpy
import
theano
# Skip test if cuda_ndarray is not available.
from
nose.plugins.skip
import
SkipTest
import
theano.sandbox.cuda
as
cuda_ndarray
if
cuda_ndarray
.
cuda_available
==
False
:
raise
SkipTest
(
'Optional package cuda disabled'
)
try
:
from
nose.plugins.skip
import
SkipTest
import
theano.sandbox.cuda
as
cuda_ndarray
if
cuda_ndarray
.
cuda_available
==
False
:
raise
SkipTest
(
'Optional package cuda disabled'
)
except
ImportError
:
# To have the GPU back-end work without nose, we need this file to
# be importable without nose.
pass
from
theano.gof.python25
import
any
import
theano.sandbox.cuda
as
cuda
import
theano.sandbox.cuda.basic_ops
as
B
...
...
theano/tensor/signal/conv.py
浏览文件 @
53e556fc
...
...
@@ -5,6 +5,9 @@ generic 2D convolution.
__docformat__
=
"restructuredtext en"
import
warnings
import
theano
import
theano.tensor
as
tensor
from
theano.tensor.nnet
import
conv
...
...
@@ -82,7 +85,16 @@ def conv2d(input, filters, image_shape=None, filter_shape=None,
output
=
op
(
input4D
,
filters4D
)
# flatten to 3D tensor if convolving with single filter or single image
if
input
.
ndim
==
2
or
filters
.
ndim
==
2
:
if
input
.
ndim
==
2
and
filters
.
ndim
==
2
:
if
theano
.
config
.
warn
.
signal_conv2d_interface
:
warnings
.
warn
(
"theano.tensor.signal.conv2d() now output 2d tensor when both"
" inputs are 2d. To disable this warning, set the Theano flag"
" warn.signal_conv2d_interface to False"
,
stacklevel
=
3
)
output
=
tensor
.
flatten
(
output
.
T
,
outdim
=
2
)
.
T
elif
input
.
ndim
==
2
or
filters
.
ndim
==
2
:
output
=
tensor
.
flatten
(
output
.
T
,
outdim
=
3
)
.
T
return
output
theano/tensor/signal/tests/test_conv.py
浏览文件 @
53e556fc
...
...
@@ -17,7 +17,7 @@ class TestSignalConv2D(unittest.TestCase):
def
setUp
(
self
):
utt
.
seed_rng
()
def
validate
(
self
,
image_shape
,
filter_shape
,
verify_grad
=
True
):
def
validate
(
self
,
image_shape
,
filter_shape
,
out_dim
,
verify_grad
=
True
):
image_dim
=
len
(
image_shape
)
filter_dim
=
len
(
filter_shape
)
...
...
@@ -36,6 +36,7 @@ class TestSignalConv2D(unittest.TestCase):
def
sym_conv2d
(
input
,
filters
):
return
conv
.
conv2d
(
input
,
filters
)
output
=
sym_conv2d
(
input
,
filters
)
assert
output
.
ndim
==
out_dim
theano_conv
=
theano
.
function
([
input
,
filters
],
output
)
# initialize input and compute result
...
...
@@ -90,10 +91,10 @@ class TestSignalConv2D(unittest.TestCase):
theano
.
config
.
cxx
==
""
):
raise
SkipTest
(
"conv2d tests need SciPy or a c++ compiler"
)
self
.
validate
((
1
,
4
,
5
),
(
2
,
2
,
3
),
verify_grad
=
True
)
self
.
validate
((
7
,
5
),
(
5
,
2
,
3
),
verify_grad
=
False
)
self
.
validate
((
3
,
7
,
5
),
(
2
,
3
),
verify_grad
=
False
)
self
.
validate
((
7
,
5
),
(
2
,
3
),
verify_grad
=
False
)
self
.
validate
((
1
,
4
,
5
),
(
2
,
2
,
3
),
out_dim
=
4
,
verify_grad
=
True
)
self
.
validate
((
7
,
5
),
(
5
,
2
,
3
),
out_dim
=
3
,
verify_grad
=
False
)
self
.
validate
((
3
,
7
,
5
),
(
2
,
3
),
out_dim
=
3
,
verify_grad
=
False
)
self
.
validate
((
7
,
5
),
(
2
,
3
),
out_dim
=
2
,
verify_grad
=
False
)
def
test_fail
(
self
):
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论