Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
71d99506
提交
71d99506
authored
10月 02, 2012
作者:
Jeremiah Lowin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
re-enabled tests of tensor dot products (using dot op)
上级
86eea375
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
74 行增加
和
24 行删除
+74
-24
test_basic.py
theano/tensor/tests/test_basic.py
+74
-24
没有找到文件。
theano/tensor/tests/test_basic.py
浏览文件 @
71d99506
...
...
@@ -4262,20 +4262,42 @@ class t_dot(unittest.TestCase):
self
.
assertTrue
(
tz
.
shape
==
nz
.
shape
)
self
.
assertTrue
(
_approx_eq
(
nz
,
tz
))
#def test_dot_0d_0d(self): self.cmp_dot(1.1, 2.2)
#def test_dot_0d_1d(self): self.cmp_dot(1.1, rand(5))
#def test_dot_0d_2d(self): self.cmp_dot(3.0, rand(6,7))
#def test_dot_0d_3d(self): self.cmp_dot(3.0, rand(8,6,7))
#def test_dot_1d_0d(self): self.cmp_dot(rand(5), 1.1 )
def
test_dot_0d_0d
(
self
):
self
.
cmp_dot
(
1.1
,
2.2
)
def
test_dot_0d_1d
(
self
):
self
.
cmp_dot
(
1.1
,
rand
(
5
))
def
test_dot_0d_2d
(
self
):
self
.
cmp_dot
(
3.0
,
rand
(
6
,
7
))
def
test_dot_0d_3d
(
self
):
self
.
cmp_dot
(
3.0
,
rand
(
8
,
6
,
7
))
def
test_dot_1d_0d
(
self
):
self
.
cmp_dot
(
rand
(
5
),
1.1
)
def
test_dot_1d_1d
(
self
):
self
.
cmp_dot
(
rand
(
5
),
rand
(
5
))
def
test_dot_1d0_1d0
(
self
):
self
.
cmp_dot
(
rand
(
0
),
rand
(
0
))
#numpy return matrix not aligned...
#def test_dot_1d_1d0(self): self.cmp_dot(rand(5), rand(0))
def
test_dot_1d_1d0
(
self
):
try
:
self
.
cmp_dot
(
rand
(
5
),
rand
(
0
))
assert
False
except
ValueError
:
pass
#numpy return matrix not aligned...
#def test_dot_1d0_1d(self): self.cmp_dot(rand(0), rand(5))
def
test_dot_1d0_1d
(
self
):
try
:
self
.
cmp_dot
(
rand
(
0
),
rand
(
5
))
assert
False
except
ValueError
:
pass
def
test_dot_1d_2d
(
self
):
self
.
cmp_dot
(
rand
(
6
),
rand
(
6
,
7
))
...
...
@@ -4288,8 +4310,12 @@ class t_dot(unittest.TestCase):
def
test_dot_1d0_2d0
(
self
):
self
.
cmp_dot
(
rand
(
0
),
rand
(
0
,
0
))
#def test_dot_1d_3d(self): self.cmp_dot(rand(6), rand(8,6,7))
#def test_dot_2d_0d(self): self.cmp_dot(rand(5,6), 1.0)
def
test_dot_1d_3d
(
self
):
self
.
cmp_dot
(
rand
(
6
),
rand
(
8
,
6
,
7
))
def
test_dot_2d_0d
(
self
):
self
.
cmp_dot
(
rand
(
5
,
6
),
1.0
)
def
test_dot_2d_1d
(
self
):
self
.
cmp_dot
(
rand
(
5
,
6
),
rand
(
6
))
...
...
@@ -4320,11 +4346,21 @@ class t_dot(unittest.TestCase):
def
test_dot_2d0_0_2d0
(
self
):
self
.
cmp_dot
(
rand
(
0
,
6
),
rand
(
6
,
0
))
#def test_dot_2d_3d(self): self.cmp_dot(rand(5,6), rand(8,6,7))
#def test_dot_3d_0d(self): self.cmp_dot(rand(4,5,6), 1.0)
#def test_dot_3d_1d(self): self.cmp_dot(rand(4,5,6), rand(6))
#def test_dot_3d_2d(self): self.cmp_dot(rand(4,5,6), rand(6,7))
#def test_dot_3d_3d(self): self.cmp_dot(rand(4,5,6), rand(8,6,7))
def
test_dot_2d_3d
(
self
):
self
.
cmp_dot
(
rand
(
5
,
6
),
rand
(
8
,
6
,
7
))
def
test_dot_3d_0d
(
self
):
self
.
cmp_dot
(
rand
(
4
,
5
,
6
),
1.0
)
def
test_dot_3d_1d
(
self
):
self
.
cmp_dot
(
rand
(
4
,
5
,
6
),
rand
(
6
))
def
test_dot_3d_2d
(
self
):
self
.
cmp_dot
(
rand
(
4
,
5
,
6
),
rand
(
6
,
7
))
def
test_dot_3d_3d
(
self
):
self
.
cmp_dot
(
rand
(
4
,
5
,
6
),
rand
(
8
,
6
,
7
))
def
not_aligned
(
self
,
x
,
y
):
ctv_backup
=
config
.
compute_test_value
...
...
@@ -4364,7 +4400,8 @@ class t_dot(unittest.TestCase):
def
test_align_1_2
(
self
):
self
.
not_aligned
(
rand
(
5
),
rand
(
6
,
4
))
#def test_align_1_3(self): self.not_aligned(rand(5), rand(6,4,7))
def
test_align_1_3
(
self
):
self
.
not_aligned
(
rand
(
5
),
rand
(
6
,
4
,
7
))
def
test_align_2_1
(
self
):
self
.
not_aligned
(
rand
(
5
,
4
),
rand
(
6
))
...
...
@@ -4372,31 +4409,44 @@ class t_dot(unittest.TestCase):
def
test_align_2_1
(
self
):
self
.
not_aligned
(
rand
(
5
,
4
),
rand
(
6
,
7
))
#def test_align_2_3(self): self.not_aligned(rand(5,4), rand(6,7,8))
#def test_align_3_1(self): self.not_aligned(rand(5,4,3), rand(6))
#def test_align_3_2(self): self.not_aligned(rand(5,4,3), rand(6,7))
#def test_align_3_3(self): self.not_aligned(rand(5,4,3), rand(6,7,8))
def
test_align_2_3
(
self
):
self
.
not_aligned
(
rand
(
5
,
4
),
rand
(
6
,
7
,
8
))
def
test_align_3_1
(
self
):
self
.
not_aligned
(
rand
(
5
,
4
,
3
),
rand
(
6
))
def
test_align_3_2
(
self
):
self
.
not_aligned
(
rand
(
5
,
4
,
3
),
rand
(
6
,
7
))
def
test_align_3_3
(
self
):
self
.
not_aligned
(
rand
(
5
,
4
,
3
),
rand
(
6
,
7
,
8
))
def
test_grad
(
self
):
#utt.verify_grad(dot, [rand(2,3,4), rand(4)])
utt
.
verify_grad
(
dot
,
[
rand
(
2
,
3
),
rand
(
3
,
2
)])
utt
.
verify_grad
(
dot
,
[
rand
(
2
),
rand
(
2
,
3
)])
utt
.
verify_grad
(
dot
,
[
rand
(
3
,
2
),
rand
(
2
)])
utt
.
verify_grad
(
dot
,
[
rand
(
2
),
rand
(
2
)])
#utt.verify_grad(dot, [rand(), rand(2)])
#utt.verify_grad(dot, [rand(), rand(2,5)])
utt
.
verify_grad
(
dot
,
[
rand
(),
rand
(
2
)])
utt
.
verify_grad
(
dot
,
[
rand
(),
rand
(
2
,
5
)])
utt
.
verify_grad
(
dot
,
[
rand
(
2
),
rand
()])
utt
.
verify_grad
(
dot
,
[
rand
(
2
,
5
),
rand
()])
utt
.
verify_grad
(
dot
,
[
rand
(
2
,
3
,
4
),
rand
(
4
)])
utt
.
verify_grad
(
dot
,
[
rand
(
3
),
rand
(
2
,
3
,
4
)])
utt
.
verify_grad
(
dot
,
[
rand
(
4
,
3
),
rand
(
2
,
3
,
4
)])
utt
.
verify_grad
(
dot
,
[
rand
(
2
,
3
,
4
),
rand
(
4
,
5
)])
utt
.
verify_grad
(
dot
,
[
rand
(
2
,
3
,
4
),
rand
(
3
,
4
,
5
)])
def
test_broadcastable_patterns
(
self
):
#
# These examples
hs
ould all work because we broadcastable or no, all dimensions of all
# These examples
sh
ould all work because we broadcastable or no, all dimensions of all
# results have size 1.
#
def
val_for
(
r
):
if
r
.
dtype
.
startswith
(
'complex'
):
# We want to test complex at the same time, so we give a value
# To the imaginary component.
# This st
ange way to doing thing
is the only way that worked on
# This st
range way of doing things
is the only way that worked on
# numpy 1.4.1
if
r
.
ndim
==
0
:
return
numpy
.
asarray
(
numpy
.
complex
(
1.1
,
2.1
),
dtype
=
r
.
dtype
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论