Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1ac53176
提交
1ac53176
authored
8月 28, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make test under theano/gof pass when no c++ compiler.
上级
df5d07f0
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
34 行增加
和
3 行删除
+34
-3
test_cc.py
theano/gof/tests/test_cc.py
+21
-2
test_compute_test_value.py
theano/gof/tests/test_compute_test_value.py
+3
-0
test_op.py
theano/gof/tests/test_op.py
+4
-1
test_vm.py
theano/gof/tests/test_vm.py
+6
-0
没有找到文件。
theano/gof/tests/test_cc.py
浏览文件 @
1ac53176
import
unittest
import
unittest
from
nose.plugins.skip
import
SkipTest
from
theano.gof.link
import
PerformLinker
from
theano.gof.link
import
PerformLinker
from
theano.gof.cc
import
*
from
theano.gof.cc
import
*
from
theano.gof.type
import
Type
from
theano.gof.type
import
Type
...
@@ -179,6 +181,8 @@ def Env(inputs, outputs):
...
@@ -179,6 +181,8 @@ def Env(inputs, outputs):
################
################
def
test_clinker_straightforward
():
def
test_clinker_straightforward
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
x
,
y
,
z
=
inputs
()
x
,
y
,
z
=
inputs
()
e
=
add
(
mul
(
add
(
x
,
y
),
div
(
x
,
y
)),
bad_sub
(
bad_sub
(
x
,
y
),
z
))
e
=
add
(
mul
(
add
(
x
,
y
),
div
(
x
,
y
)),
bad_sub
(
bad_sub
(
x
,
y
),
z
))
lnk
=
CLinker
()
.
accept
(
Env
([
x
,
y
,
z
],
[
e
]))
lnk
=
CLinker
()
.
accept
(
Env
([
x
,
y
,
z
],
[
e
]))
...
@@ -187,6 +191,8 @@ def test_clinker_straightforward():
...
@@ -187,6 +191,8 @@ def test_clinker_straightforward():
def
test_clinker_literal_inlining
():
def
test_clinker_literal_inlining
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
x
,
y
,
z
=
inputs
()
x
,
y
,
z
=
inputs
()
z
=
Constant
(
tdouble
,
4.12345678
)
z
=
Constant
(
tdouble
,
4.12345678
)
e
=
add
(
mul
(
add
(
x
,
y
),
div
(
x
,
y
)),
bad_sub
(
bad_sub
(
x
,
y
),
z
))
e
=
add
(
mul
(
add
(
x
,
y
),
div
(
x
,
y
)),
bad_sub
(
bad_sub
(
x
,
y
),
z
))
...
@@ -200,6 +206,8 @@ def test_clinker_literal_inlining():
...
@@ -200,6 +206,8 @@ def test_clinker_literal_inlining():
def
test_clinker_single_node
():
def
test_clinker_single_node
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
x
,
y
,
z
=
inputs
()
x
,
y
,
z
=
inputs
()
node
=
add
.
make_node
(
x
,
y
)
node
=
add
.
make_node
(
x
,
y
)
lnk
=
CLinker
()
.
accept
(
Env
(
node
.
inputs
,
node
.
outputs
))
lnk
=
CLinker
()
.
accept
(
Env
(
node
.
inputs
,
node
.
outputs
))
...
@@ -208,6 +216,8 @@ def test_clinker_single_node():
...
@@ -208,6 +216,8 @@ def test_clinker_single_node():
def
test_clinker_dups
():
def
test_clinker_dups
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
# Testing that duplicate inputs are allowed.
# Testing that duplicate inputs are allowed.
x
,
y
,
z
=
inputs
()
x
,
y
,
z
=
inputs
()
e
=
add
(
x
,
x
)
e
=
add
(
x
,
x
)
...
@@ -218,6 +228,8 @@ def test_clinker_dups():
...
@@ -218,6 +228,8 @@ def test_clinker_dups():
def
test_clinker_dups_inner
():
def
test_clinker_dups_inner
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
# Testing that duplicates are allowed inside the graph
# Testing that duplicates are allowed inside the graph
x
,
y
,
z
=
inputs
()
x
,
y
,
z
=
inputs
()
e
=
add
(
mul
(
y
,
y
),
add
(
x
,
z
))
e
=
add
(
mul
(
y
,
y
),
add
(
x
,
z
))
...
@@ -235,8 +247,11 @@ def test_opwiseclinker_straightforward():
...
@@ -235,8 +247,11 @@ def test_opwiseclinker_straightforward():
e
=
add
(
mul
(
add
(
x
,
y
),
div
(
x
,
y
)),
bad_sub
(
bad_sub
(
x
,
y
),
z
))
e
=
add
(
mul
(
add
(
x
,
y
),
div
(
x
,
y
)),
bad_sub
(
bad_sub
(
x
,
y
),
z
))
lnk
=
OpWiseCLinker
()
.
accept
(
Env
([
x
,
y
,
z
],
[
e
]))
lnk
=
OpWiseCLinker
()
.
accept
(
Env
([
x
,
y
,
z
],
[
e
]))
fn
=
lnk
.
make_function
()
fn
=
lnk
.
make_function
()
if
theano
.
config
.
cxx
:
assert
fn
(
2.0
,
2.0
,
2.0
)
==
2.0
assert
fn
(
2.0
,
2.0
,
2.0
)
==
2.0
else
:
# The python version of bad_sub always return -10.
assert
fn
(
2.0
,
2.0
,
2.0
)
==
-
6
def
test_opwiseclinker_constant
():
def
test_opwiseclinker_constant
():
x
,
y
,
z
=
inputs
()
x
,
y
,
z
=
inputs
()
...
@@ -272,6 +287,8 @@ def test_duallinker_straightforward():
...
@@ -272,6 +287,8 @@ def test_duallinker_straightforward():
def
test_duallinker_mismatch
():
def
test_duallinker_mismatch
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
x
,
y
,
z
=
inputs
()
x
,
y
,
z
=
inputs
()
# bad_sub is correct in C but erroneous in Python
# bad_sub is correct in C but erroneous in Python
e
=
bad_sub
(
mul
(
x
,
y
),
mul
(
y
,
z
))
e
=
bad_sub
(
mul
(
x
,
y
),
mul
(
y
,
z
))
...
@@ -315,7 +332,9 @@ class AddFail(Binary):
...
@@ -315,7 +332,9 @@ class AddFail(Binary):
add_fail
=
AddFail
()
add_fail
=
AddFail
()
def
test_fail_error
():
def
test_c_fail_error
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
x
,
y
,
z
=
inputs
()
x
,
y
,
z
=
inputs
()
x
=
Constant
(
tdouble
,
7.2
,
name
=
'x'
)
x
=
Constant
(
tdouble
,
7.2
,
name
=
'x'
)
e
=
add_fail
(
mul
(
x
,
y
),
mul
(
y
,
z
))
e
=
add_fail
(
mul
(
x
,
y
),
mul
(
y
,
z
))
...
...
theano/gof/tests/test_compute_test_value.py
浏览文件 @
1ac53176
import
os
,
sys
,
traceback
,
warnings
import
os
,
sys
,
traceback
,
warnings
import
numpy
import
numpy
from
nose.plugins.skip
import
SkipTest
import
unittest
import
unittest
import
theano
import
theano
...
@@ -334,6 +335,8 @@ class TestComputeTestValue(unittest.TestCase):
...
@@ -334,6 +335,8 @@ class TestComputeTestValue(unittest.TestCase):
theano
.
config
.
compute_test_value
=
orig_compute_test_value
theano
.
config
.
compute_test_value
=
orig_compute_test_value
def
test_no_perform
(
self
):
def
test_no_perform
(
self
):
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
class
IncOneC
(
Op
):
class
IncOneC
(
Op
):
"""An Op with only a C (c_code) implementation"""
"""An Op with only a C (c_code) implementation"""
...
...
theano/gof/tests/test_op.py
浏览文件 @
1ac53176
...
@@ -184,12 +184,15 @@ class TestMakeThunk(unittest.TestCase):
...
@@ -184,12 +184,15 @@ class TestMakeThunk(unittest.TestCase):
thunk
=
o
.
owner
.
op
.
make_thunk
(
o
.
owner
,
storage_map
,
compute_map
,
thunk
=
o
.
owner
.
op
.
make_thunk
(
o
.
owner
,
storage_map
,
compute_map
,
no_recycling
=
[])
no_recycling
=
[])
if
theano
.
config
.
cxx
:
required
=
thunk
()
required
=
thunk
()
# Check everything went OK
# Check everything went OK
assert
not
required
# We provided all inputs
assert
not
required
# We provided all inputs
assert
compute_map
[
o
][
0
]
assert
compute_map
[
o
][
0
]
assert
storage_map
[
o
][
0
]
==
4
assert
storage_map
[
o
][
0
]
==
4
else
:
self
.
assertRaises
((
NotImplementedError
,
utils
.
MethodNotDefined
),
thunk
)
def
test_test_value_python_objects
():
def
test_test_value_python_objects
():
...
...
theano/gof/tests/test_vm.py
浏览文件 @
1ac53176
...
@@ -6,6 +6,8 @@ try:
...
@@ -6,6 +6,8 @@ try:
import
line_profiler
import
line_profiler
except
ImportError
:
except
ImportError
:
pass
pass
from
nose.plugins.skip
import
SkipTest
import
numpy
import
numpy
from
theano
import
function
from
theano
import
function
...
@@ -55,6 +57,8 @@ class TestCallbacks(unittest.TestCase):
...
@@ -55,6 +57,8 @@ class TestCallbacks(unittest.TestCase):
def
test_speed
():
def
test_speed
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
def
build_graph
(
x
,
depth
=
5
):
def
build_graph
(
x
,
depth
=
5
):
z
=
x
z
=
x
...
@@ -124,6 +128,7 @@ def test_speed():
...
@@ -124,6 +128,7 @@ def test_speed():
time_linker
(
'c|py'
,
OpWiseCLinker
)
time_linker
(
'c|py'
,
OpWiseCLinker
)
time_linker
(
'vmLinker'
,
vm
.
VM_Linker
)
time_linker
(
'vmLinker'
,
vm
.
VM_Linker
)
time_linker
(
'vmLinker_nogc'
,
lambda
:
vm
.
VM_Linker
(
allow_gc
=
False
))
time_linker
(
'vmLinker_nogc'
,
lambda
:
vm
.
VM_Linker
(
allow_gc
=
False
))
if
theano
.
config
.
cxx
:
time_linker
(
'vmLinker_CLOOP'
,
lambda
:
vm
.
VM_Linker
(
allow_gc
=
False
,
time_linker
(
'vmLinker_CLOOP'
,
lambda
:
vm
.
VM_Linker
(
allow_gc
=
False
,
use_cloop
=
True
))
use_cloop
=
True
))
time_numpy
()
time_numpy
()
...
@@ -175,6 +180,7 @@ def test_speed_lazy():
...
@@ -175,6 +180,7 @@ def test_speed_lazy():
time_linker
(
'vmLinker'
,
vm
.
VM_Linker
)
time_linker
(
'vmLinker'
,
vm
.
VM_Linker
)
time_linker
(
'vmLinker_nogc'
,
lambda
:
vm
.
VM_Linker
(
allow_gc
=
False
))
time_linker
(
'vmLinker_nogc'
,
lambda
:
vm
.
VM_Linker
(
allow_gc
=
False
))
if
theano
.
config
.
cxx
:
time_linker
(
'vmLinker_C'
,
lambda
:
vm
.
VM_Linker
(
allow_gc
=
False
,
time_linker
(
'vmLinker_C'
,
lambda
:
vm
.
VM_Linker
(
allow_gc
=
False
,
use_cloop
=
True
))
use_cloop
=
True
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论