Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f6a2d6e2
提交
f6a2d6e2
authored
1月 25, 2012
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #380 from delallea/fix_tests_exc_verb
Fixed some tests broken due to exception verbosity
上级
0c1dcabd
d92c9e65
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
35 行增加
和
20 行删除
+35
-20
test_basic.py
theano/tensor/tests/test_basic.py
+35
-20
没有找到文件。
theano/tensor/tests/test_basic.py
浏览文件 @
f6a2d6e2
...
@@ -3527,19 +3527,34 @@ class t_dot(unittest.TestCase):
...
@@ -3527,19 +3527,34 @@ class t_dot(unittest.TestCase):
try
:
try
:
try
:
try
:
tz
=
eval_outputs
([
z
])
tz
=
eval_outputs
([
z
])
assert
False
# should have raised exception
assert
False
# should have raised exception
except
ValueError
,
e
:
except
ValueError
,
e
:
self
.
assertTrue
(
self
.
assertTrue
(
e
[
0
]
.
split
()[
1
:
4
]
==
[
'are'
,
'not'
,
'aligned'
]
or
# reported by numpy
# Reported by numpy.
e
[
0
]
.
split
()[
0
:
2
]
==
[
'Shape'
,
'mismatch:'
],
e
)
# reported by blas return self.fail()
e
[
0
]
.
split
()[
1
:
4
]
==
[
'are'
,
'not'
,
'aligned'
]
or
# Reported by blas.
e
[
0
]
.
split
()[
0
:
2
]
==
[
'Shape'
,
'mismatch:'
]
or
# Reported by Theano when 'exception_verbosity' is set
# to 'high'.
e
[
0
]
.
split
()[
0
:
3
]
==
[
'dot'
,
'product'
,
'failed.'
],
e
)
finally
:
finally
:
_logger
.
setLevel
(
oldlevel
)
_logger
.
setLevel
(
oldlevel
)
def
test_align_1_1
(
self
):
self
.
not_aligned
(
rand
(
5
),
rand
(
6
))
def
test_align_1_1
(
self
):
def
test_align_1_2
(
self
):
self
.
not_aligned
(
rand
(
5
),
rand
(
6
,
4
))
self
.
not_aligned
(
rand
(
5
),
rand
(
6
))
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
))
def
test_align_2_1
(
self
):
self
.
not_aligned
(
rand
(
5
,
4
),
rand
(
6
,
7
))
def
test_align_2_1
(
self
):
self
.
not_aligned
(
rand
(
5
,
4
),
rand
(
6
))
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_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_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_2(self): self.not_aligned(rand(5,4,3), rand(6,7))
...
@@ -5179,23 +5194,24 @@ def test_dimshuffle_duplicate():
...
@@ -5179,23 +5194,24 @@ def test_dimshuffle_duplicate():
assert
success
assert
success
class
T_get_constant_value
(
unittest
.
TestCase
):
class
T_get_constant_value
(
unittest
.
TestCase
):
def
test_get_constant_value
(
self
):
def
test_get_constant_value
(
self
):
a
=
tensor
.
stack
(
1
,
2
,
3
)
a
=
tensor
.
stack
(
1
,
2
,
3
)
assert
get_constant_value
(
a
[
0
])
==
1
assert
get_constant_value
(
a
[
0
])
==
1
assert
get_constant_value
(
a
[
1
])
==
2
assert
get_constant_value
(
a
[
1
])
==
2
assert
get_constant_value
(
a
[
2
])
==
3
assert
get_constant_value
(
a
[
2
])
==
3
b
=
tensor
.
iscalar
()
b
=
tensor
.
iscalar
()
a
=
tensor
.
stack
(
b
,
2
,
3
)
a
=
tensor
.
stack
(
b
,
2
,
3
)
self
.
assertRaises
(
TypeError
,
get_constant_value
,
a
[
0
])
self
.
assertRaises
(
TypeError
,
get_constant_value
,
a
[
0
])
assert
get_constant_value
(
a
[
1
])
==
2
assert
get_constant_value
(
a
[
1
])
==
2
assert
get_constant_value
(
a
[
2
])
==
3
assert
get_constant_value
(
a
[
2
])
==
3
# For now get_constant_value goes through only MakeVector and Join of
# For now get_constant_value goes through only MakeVector and Join of
# scalars.
# scalars.
v
=
tensor
.
ivector
()
v
=
tensor
.
ivector
()
a
=
tensor
.
stack
(
v
,
2
,
3
)
a
=
tensor
.
stack
(
v
,
2
,
3
)
self
.
assertRaises
(
TypeError
,
get_constant_value
,
a
[
0
])
self
.
assertRaises
(
TypeError
,
get_constant_value
,
a
[
0
])
self
.
assertRaises
(
TypeError
,
get_constant_value
,
a
[
1
])
self
.
assertRaises
(
TypeError
,
get_constant_value
,
a
[
1
])
self
.
assertRaises
(
TypeError
,
get_constant_value
,
a
[
2
])
self
.
assertRaises
(
TypeError
,
get_constant_value
,
a
[
2
])
...
@@ -5203,16 +5219,16 @@ class T_get_constant_value(unittest.TestCase):
...
@@ -5203,16 +5219,16 @@ class T_get_constant_value(unittest.TestCase):
# Test the case SubTensor(Shape(v)) when the dimensions
# Test the case SubTensor(Shape(v)) when the dimensions
# is broadcastable.
# is broadcastable.
v
=
tensor
.
row
()
v
=
tensor
.
row
()
assert
get_constant_value
(
v
.
shape
[
0
])
==
1
assert
get_constant_value
(
v
.
shape
[
0
])
==
1
def
test_subtensor_of_constant
(
self
):
def
test_subtensor_of_constant
(
self
):
c
=
constant
(
rand
(
5
))
c
=
constant
(
rand
(
5
))
for
i
in
range
(
c
.
value
.
shape
[
0
]):
for
i
in
range
(
c
.
value
.
shape
[
0
]):
assert
get_constant_value
(
c
[
i
])
==
c
.
value
[
i
]
assert
get_constant_value
(
c
[
i
])
==
c
.
value
[
i
]
c
=
constant
(
rand
(
5
,
5
))
c
=
constant
(
rand
(
5
,
5
))
for
i
in
range
(
c
.
value
.
shape
[
0
]):
for
i
in
range
(
c
.
value
.
shape
[
0
]):
for
j
in
range
(
c
.
value
.
shape
[
1
]):
for
j
in
range
(
c
.
value
.
shape
[
1
]):
assert
get_constant_value
(
c
[
i
,
j
])
==
c
.
value
[
i
,
j
]
assert
get_constant_value
(
c
[
i
,
j
])
==
c
.
value
[
i
,
j
]
class
T_as_tensor_variable
(
unittest
.
TestCase
):
class
T_as_tensor_variable
(
unittest
.
TestCase
):
...
@@ -5323,7 +5339,7 @@ def test_transpose():
...
@@ -5323,7 +5339,7 @@ def test_transpose():
tensor
.
transpose
(
x3
,
[
0
,
2
,
1
]),
tensor
.
transpose
(
x3
,
[
0
,
2
,
1
]),
])
])
t1
,
t2
,
t3
,
t1b
,
t2b
,
t3b
,
t2c
,
t3c
,
t2d
,
t3d
=
f
(
x1v
,
x2v
,
x3v
)
t1
,
t2
,
t3
,
t1b
,
t2b
,
t3b
,
t2c
,
t3c
,
t2d
,
t3d
=
f
(
x1v
,
x2v
,
x3v
)
assert
t1
.
shape
==
numpy
.
transpose
(
x1v
)
.
shape
assert
t1
.
shape
==
numpy
.
transpose
(
x1v
)
.
shape
assert
t2
.
shape
==
numpy
.
transpose
(
x2v
)
.
shape
assert
t2
.
shape
==
numpy
.
transpose
(
x2v
)
.
shape
assert
t3
.
shape
==
numpy
.
transpose
(
x3v
)
.
shape
assert
t3
.
shape
==
numpy
.
transpose
(
x3v
)
.
shape
...
@@ -5343,7 +5359,6 @@ def test_transpose():
...
@@ -5343,7 +5359,6 @@ def test_transpose():
assert
numpy
.
all
(
t3d
==
numpy
.
transpose
(
x3v
,
[
0
,
2
,
1
]))
assert
numpy
.
all
(
t3d
==
numpy
.
transpose
(
x3v
,
[
0
,
2
,
1
]))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
if
0
:
if
0
:
unittest
.
main
()
unittest
.
main
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论