Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
40274190
提交
40274190
authored
6月 07, 2011
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Put back the initial value of compute_test_value at the end of tests
上级
6f2690dd
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
25 行增加
和
1 行删除
+25
-1
test_compute_test_value.py
theano/gof/tests/test_compute_test_value.py
+25
-1
没有找到文件。
theano/gof/tests/test_compute_test_value.py
浏览文件 @
40274190
...
@@ -8,6 +8,8 @@ from theano import tensor as T
...
@@ -8,6 +8,8 @@ from theano import tensor as T
class
TestComputeTestValue
(
unittest
.
TestCase
):
class
TestComputeTestValue
(
unittest
.
TestCase
):
def
test_variable_only
(
self
):
def
test_variable_only
(
self
):
orig_compute_test_value
=
theano
.
config
.
compute_test_value
try
:
theano
.
config
.
compute_test_value
=
True
theano
.
config
.
compute_test_value
=
True
x
=
T
.
matrix
(
'x'
)
x
=
T
.
matrix
(
'x'
)
...
@@ -21,9 +23,13 @@ class TestComputeTestValue(unittest.TestCase):
...
@@ -21,9 +23,13 @@ class TestComputeTestValue(unittest.TestCase):
# this test should fail
# this test should fail
y
.
tag
.
test_value
=
numpy
.
random
.
rand
(
6
,
5
)
y
.
tag
.
test_value
=
numpy
.
random
.
rand
(
6
,
5
)
self
.
assertRaises
(
ValueError
,
T
.
dot
,
x
,
y
)
self
.
assertRaises
(
ValueError
,
T
.
dot
,
x
,
y
)
finally
:
theano
.
config
.
compute_test_value
=
orig_compute_test_value
def
test_compute_flag
(
self
):
def
test_compute_flag
(
self
):
orig_compute_test_value
=
theano
.
config
.
compute_test_value
try
:
x
=
T
.
matrix
(
'x'
)
x
=
T
.
matrix
(
'x'
)
y
=
T
.
matrix
(
'y'
)
y
=
T
.
matrix
(
'y'
)
y
.
tag
.
test_value
=
numpy
.
random
.
rand
(
4
,
5
)
y
.
tag
.
test_value
=
numpy
.
random
.
rand
(
4
,
5
)
...
@@ -37,8 +43,12 @@ class TestComputeTestValue(unittest.TestCase):
...
@@ -37,8 +43,12 @@ class TestComputeTestValue(unittest.TestCase):
self
.
assertRaises
(
Warning
,
T
.
dot
,
x
,
y
)
self
.
assertRaises
(
Warning
,
T
.
dot
,
x
,
y
)
theano
.
config
.
compute_test_value
=
'err'
theano
.
config
.
compute_test_value
=
'err'
self
.
assertRaises
(
ValueError
,
T
.
dot
,
x
,
y
)
self
.
assertRaises
(
ValueError
,
T
.
dot
,
x
,
y
)
finally
:
theano
.
config
.
compute_test_value
=
orig_compute_test_value
def
test_string_var
(
self
):
def
test_string_var
(
self
):
orig_compute_test_value
=
theano
.
config
.
compute_test_value
try
:
theano
.
config
.
compute_test_value
=
True
theano
.
config
.
compute_test_value
=
True
x
=
T
.
matrix
(
'x'
)
x
=
T
.
matrix
(
'x'
)
...
@@ -56,8 +66,12 @@ class TestComputeTestValue(unittest.TestCase):
...
@@ -56,8 +66,12 @@ class TestComputeTestValue(unittest.TestCase):
# this test should fail
# this test should fail
z
.
set_value
(
numpy
.
random
.
rand
(
7
,
6
))
z
.
set_value
(
numpy
.
random
.
rand
(
7
,
6
))
self
.
assertRaises
(
ValueError
,
f
,
x
,
y
,
z
)
self
.
assertRaises
(
ValueError
,
f
,
x
,
y
,
z
)
finally
:
theano
.
config
.
compute_test_value
=
orig_compute_test_value
def
test_shared
(
self
):
def
test_shared
(
self
):
orig_compute_test_value
=
theano
.
config
.
compute_test_value
try
:
theano
.
config
.
compute_test_value
=
True
theano
.
config
.
compute_test_value
=
True
x
=
T
.
matrix
(
'x'
)
x
=
T
.
matrix
(
'x'
)
...
@@ -70,8 +84,12 @@ class TestComputeTestValue(unittest.TestCase):
...
@@ -70,8 +84,12 @@ class TestComputeTestValue(unittest.TestCase):
# this test should fail
# this test should fail
y
.
set_value
(
numpy
.
random
.
rand
(
5
,
6
))
y
.
set_value
(
numpy
.
random
.
rand
(
5
,
6
))
self
.
assertRaises
(
ValueError
,
T
.
dot
,
x
,
y
)
self
.
assertRaises
(
ValueError
,
T
.
dot
,
x
,
y
)
finally
:
theano
.
config
.
compute_test_value
=
orig_compute_test_value
def
test_ndarray
(
self
):
def
test_ndarray
(
self
):
orig_compute_test_value
=
theano
.
config
.
compute_test_value
try
:
theano
.
config
.
compute_test_value
=
True
theano
.
config
.
compute_test_value
=
True
x
=
numpy
.
random
.
rand
(
2
,
3
)
x
=
numpy
.
random
.
rand
(
2
,
3
)
...
@@ -83,8 +101,12 @@ class TestComputeTestValue(unittest.TestCase):
...
@@ -83,8 +101,12 @@ class TestComputeTestValue(unittest.TestCase):
# this test should fail
# this test should fail
x
=
numpy
.
random
.
rand
(
2
,
4
)
x
=
numpy
.
random
.
rand
(
2
,
4
)
self
.
assertRaises
(
ValueError
,
T
.
dot
,
x
,
y
)
self
.
assertRaises
(
ValueError
,
T
.
dot
,
x
,
y
)
finally
:
theano
.
config
.
compute_test_value
=
orig_compute_test_value
def
test_constant
(
self
):
def
test_constant
(
self
):
orig_compute_test_value
=
theano
.
config
.
compute_test_value
try
:
theano
.
config
.
compute_test_value
=
True
theano
.
config
.
compute_test_value
=
True
x
=
T
.
constant
(
numpy
.
random
.
rand
(
2
,
3
))
x
=
T
.
constant
(
numpy
.
random
.
rand
(
2
,
3
))
...
@@ -96,3 +118,5 @@ class TestComputeTestValue(unittest.TestCase):
...
@@ -96,3 +118,5 @@ class TestComputeTestValue(unittest.TestCase):
# this test should fail
# this test should fail
x
=
T
.
constant
(
numpy
.
random
.
rand
(
2
,
4
))
x
=
T
.
constant
(
numpy
.
random
.
rand
(
2
,
4
))
self
.
assertRaises
(
ValueError
,
T
.
dot
,
x
,
y
)
self
.
assertRaises
(
ValueError
,
T
.
dot
,
x
,
y
)
finally
:
theano
.
config
.
compute_test_value
=
orig_compute_test_value
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论