Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
aa4ac20e
提交
aa4ac20e
authored
8月 28, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make tests pass when there is no c++ compiler in theano/compile
上级
08cf79e4
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
6 行删除
+24
-6
test_debugmode.py
theano/compile/tests/test_debugmode.py
+19
-5
test_modes.py
theano/compile/tests/test_modes.py
+5
-1
没有找到文件。
theano/compile/tests/test_debugmode.py
浏览文件 @
aa4ac20e
...
...
@@ -197,19 +197,22 @@ wb1 = WeirdBrokenOp('times1')
def
test_badthunkoutput
():
# Check if the c and python code is consistent.
a
=
theano
.
tensor
.
dvector
()
b
=
theano
.
tensor
.
dvector
()
f_good
=
theano
.
function
([
a
,
b
],
off_by_half
(
a
,
b
),
mode
=
debugmode
.
DebugMode
(
check_c_code
=
True
))
mode
=
debugmode
.
DebugMode
(
check_c_code
=
theano
.
config
.
cxx
))
f_inconsistent
=
theano
.
function
([
a
,
b
],
inconsistent
(
a
,
b
),
mode
=
debugmode
.
DebugMode
(
check_c_code
=
True
))
mode
=
debugmode
.
DebugMode
(
check_c_code
=
theano
.
config
.
cxx
))
#this should evaluate with no error
f_good
([
1.0
,
2.0
,
3.0
],
[
2
,
3
,
4
])
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
try
:
f_inconsistent
([
1.0
,
2.0
,
3.0
],
[
2
,
3
,
4
])
except
debugmode
.
BadThunkOutput
,
e
:
...
...
@@ -234,7 +237,7 @@ def test_badoptimization():
b
=
theano
.
tensor
.
dvector
()
f
=
theano
.
function
([
a
,
b
],
a
+
b
,
mode
=
debugmode
.
DebugMode
(
optimizer
=
opt
,
check_c_code
=
True
))
mode
=
debugmode
.
DebugMode
(
optimizer
=
opt
))
try
:
f
([
1.0
,
2.0
,
3.0
],
[
2
,
3
,
4
],)
...
...
@@ -282,6 +285,8 @@ def test_stochasticoptimization():
def
test_just_c_code
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
x
=
theano
.
tensor
.
dvector
()
f
=
theano
.
function
([
x
],
wb2
(
x
),
mode
=
debugmode
.
DebugMode
(
check_py_code
=
False
))
...
...
@@ -312,6 +317,8 @@ def test_baddestroymap():
def
test_baddestroymap_c
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
x
=
theano
.
tensor
.
dvector
()
f
=
theano
.
function
([
x
],
wb2i
(
x
),
mode
=
debugmode
.
DebugMode
(
check_py_code
=
False
))
...
...
@@ -378,6 +385,8 @@ class Test_ViewMap(unittest.TestCase):
assert
False
# failed to raise error
def
test_badviewmap_c
(
self
):
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
x
=
theano
.
tensor
.
dvector
()
f
=
theano
.
function
([
x
],
wb1i
(
x
),
mode
=
debugmode
.
DebugMode
(
check_py_code
=
False
))
...
...
@@ -721,7 +730,12 @@ class Test_preallocated_output(unittest.TestCase):
check_preallocated_output
=
[
'f_contiguous'
])
f
=
theano
.
function
([
a
,
b
],
out
,
mode
=
mode
)
self
.
assertRaises
(
debugmode
.
BadThunkOutput
,
f
,
a_val
,
b_val
)
if
theano
.
config
.
cxx
:
self
.
assertRaises
(
debugmode
.
BadThunkOutput
,
f
,
a_val
,
b_val
)
else
:
# The python code of this op is good.
f
(
a_val
,
b_val
)
def
test_output_broadcast_tensor
(
self
):
v
=
theano
.
tensor
.
fvector
(
'v'
)
...
...
theano/compile/tests/test_modes.py
浏览文件 @
aa4ac20e
...
...
@@ -22,7 +22,11 @@ class T_bunch_of_modes(unittest.TestCase):
predef_modes
.
append
(
ProfileMode
())
# Linkers to use with regular Mode
linkers
=
[
'c|py'
,
'c|py_nogc'
,
'vm'
,
'vm_nogc'
,
'cvm'
,
'cvm_nogc'
]
if
theano
.
config
.
cxx
:
linkers
=
[
'py'
,
'c|py'
,
'c|py_nogc'
,
'vm'
,
'vm_nogc'
,
'cvm'
,
'cvm_nogc'
]
else
:
linkers
=
[
'py'
,
'c|py'
,
'c|py_nogc'
,
'vm'
,
'vm_nogc'
]
modes
=
predef_modes
+
[
Mode
(
linker
,
'fast_run'
)
for
linker
in
linkers
]
for
mode
in
modes
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论