Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ac7b5225
提交
ac7b5225
authored
10月 19, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace theano.tensor alias T with tt in tests.tensor.signal
上级
e103e7fb
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
11 行增加
和
9 行删除
+11
-9
test_conv.py
tests/tensor/signal/test_conv.py
+11
-9
没有找到文件。
tests/tensor/signal/test_conv.py
浏览文件 @
ac7b5225
...
@@ -2,13 +2,15 @@ import pytest
...
@@ -2,13 +2,15 @@ import pytest
import
numpy
as
np
import
numpy
as
np
import
theano
import
theano
import
theano.tensor
as
T
import
theano.tensor
as
tt
from
theano.tensor.signal
import
conv
from
theano.tensor.signal
import
conv
from
theano.tensor.basic
import
_allclose
from
theano.tensor.basic
import
_allclose
from
tests
import
unittest_tools
as
utt
from
tests
import
unittest_tools
as
utt
_
=
pytest
.
importorskip
(
"scipy.signal"
)
class
TestSignalConv2D
:
class
TestSignalConv2D
:
def
setup_method
(
self
):
def
setup_method
(
self
):
...
@@ -18,8 +20,8 @@ class TestSignalConv2D:
...
@@ -18,8 +20,8 @@ class TestSignalConv2D:
image_dim
=
len
(
image_shape
)
image_dim
=
len
(
image_shape
)
filter_dim
=
len
(
filter_shape
)
filter_dim
=
len
(
filter_shape
)
input
=
T
.
TensorType
(
"float64"
,
[
False
]
*
image_dim
)()
input
=
tt
.
TensorType
(
"float64"
,
[
False
]
*
image_dim
)()
filters
=
T
.
TensorType
(
"float64"
,
[
False
]
*
filter_dim
)()
filters
=
tt
.
TensorType
(
"float64"
,
[
False
]
*
filter_dim
)()
bsize
=
image_shape
[
0
]
bsize
=
image_shape
[
0
]
if
image_dim
!=
3
:
if
image_dim
!=
3
:
...
@@ -84,8 +86,8 @@ class TestSignalConv2D:
...
@@ -84,8 +86,8 @@ class TestSignalConv2D:
utt
.
verify_grad
(
sym_conv2d
,
[
image_data
,
filter_data
])
utt
.
verify_grad
(
sym_conv2d
,
[
image_data
,
filter_data
])
@pytest.mark.skipif
(
@pytest.mark.skipif
(
not
theano
.
tensor
.
nnet
.
conv
.
imported_scipy_signal
and
theano
.
config
.
cxx
==
""
,
theano
.
config
.
cxx
==
""
,
reason
=
"conv2d tests need
SciPy or
a c++ compiler"
,
reason
=
"conv2d tests need a c++ compiler"
,
)
)
def
test_basic
(
self
):
def
test_basic
(
self
):
# Basic functionality of nnet.conv.ConvOp is already tested by
# Basic functionality of nnet.conv.ConvOp is already tested by
...
@@ -101,15 +103,15 @@ class TestSignalConv2D:
...
@@ -101,15 +103,15 @@ class TestSignalConv2D:
# Test that conv2d fails for dimensions other than 2 or 3.
# Test that conv2d fails for dimensions other than 2 or 3.
with
pytest
.
raises
(
Exception
):
with
pytest
.
raises
(
Exception
):
conv
.
conv2d
(
T
.
dtensor4
(),
T
.
dtensor3
())
conv
.
conv2d
(
tt
.
dtensor4
(),
tt
.
dtensor3
())
with
pytest
.
raises
(
Exception
):
with
pytest
.
raises
(
Exception
):
conv
.
conv2d
(
T
.
dtensor3
(),
T
.
dvector
())
conv
.
conv2d
(
tt
.
dtensor3
(),
tt
.
dvector
())
def
test_bug_josh_reported
(
self
):
def
test_bug_josh_reported
(
self
):
# Test refers to a bug reported by Josh, when due to a bad merge these
# Test refers to a bug reported by Josh, when due to a bad merge these
# few lines of code failed. See
# few lines of code failed. See
# http://groups.google.com/group/theano-dev/browse_thread/thread/8856e7ca5035eecb
# http://groups.google.com/group/theano-dev/browse_thread/thread/8856e7ca5035eecb
m1
=
t
heano
.
tensor
.
matrix
()
m1
=
t
t
.
matrix
()
m2
=
t
heano
.
tensor
.
matrix
()
m2
=
t
t
.
matrix
()
conv
.
conv2d
(
m1
,
m2
)
conv
.
conv2d
(
m1
,
m2
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论