Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5ac06c76
提交
5ac06c76
authored
8月 28, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
skip make test pass when no c++ compiler under theano/{tensor,sparse}
上级
1ac53176
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
39 行增加
和
6 行删除
+39
-6
test_basic.py
theano/sparse/tests/test_basic.py
+3
-2
test_opt.py
theano/sparse/tests/test_opt.py
+10
-0
test_basic.py
theano/tensor/tests/test_basic.py
+8
-3
test_blas.py
theano/tensor/tests/test_blas.py
+2
-1
test_elemwise.py
theano/tensor/tests/test_elemwise.py
+16
-0
没有找到文件。
theano/sparse/tests/test_basic.py
浏览文件 @
5ac06c76
...
@@ -1012,7 +1012,7 @@ class test_structureddot(unittest.TestCase):
...
@@ -1012,7 +1012,7 @@ class test_structureddot(unittest.TestCase):
overhead_tol
=
0.002
# seconds
overhead_tol
=
0.002
# seconds
overhead_rtol
=
1.1
# times as long
overhead_rtol
=
1.1
# times as long
self
.
assertTrue
(
numpy
.
allclose
(
theano_result
,
scipy_result
))
self
.
assertTrue
(
numpy
.
allclose
(
theano_result
,
scipy_result
))
if
not
theano
.
config
.
mode
in
[
"DebugMode"
,
"DEBUG_MODE"
]:
if
not
theano
.
config
.
mode
in
[
"DebugMode"
,
"DEBUG_MODE"
]
and
theano
.
config
.
cxx
:
self
.
assertFalse
(
theano_time
>
overhead_rtol
*
scipy_time
+
self
.
assertFalse
(
theano_time
>
overhead_rtol
*
scipy_time
+
overhead_tol
)
overhead_tol
)
...
@@ -1198,7 +1198,8 @@ class UsmmTests(unittest.TestCase):
...
@@ -1198,7 +1198,8 @@ class UsmmTests(unittest.TestCase):
fast_compile
=
theano
.
config
.
mode
==
"FAST_COMPILE"
fast_compile
=
theano
.
config
.
mode
==
"FAST_COMPILE"
if
(
y
.
type
.
dtype
==
up
and
format1
==
'csc'
and
format2
==
'dense'
if
(
y
.
type
.
dtype
==
up
and
format1
==
'csc'
and
format2
==
'dense'
and
not
fast_compile
)
and
up
in
(
'float32'
,
'float64'
):
and
not
fast_compile
and
theano
.
config
.
cxx
and
up
in
(
'float32'
,
'float64'
)):
# The op UsmmCscDense should be inserted
# The op UsmmCscDense should be inserted
assert
(
sum
([
isinstance
(
node
.
op
,
tensor
.
Elemwise
)
and
assert
(
sum
([
isinstance
(
node
.
op
,
tensor
.
Elemwise
)
and
isinstance
(
node
.
op
.
scalar_op
,
isinstance
(
node
.
op
.
scalar_op
,
...
...
theano/sparse/tests/test_opt.py
浏览文件 @
5ac06c76
...
@@ -37,6 +37,8 @@ def test_local_csm_properties_csm():
...
@@ -37,6 +37,8 @@ def test_local_csm_properties_csm():
def
test_local_csm_grad_c
():
def
test_local_csm_grad_c
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
data
=
tensor
.
vector
()
data
=
tensor
.
vector
()
indices
,
indptr
,
shape
=
(
tensor
.
ivector
(),
tensor
.
ivector
(),
indices
,
indptr
,
shape
=
(
tensor
.
ivector
(),
tensor
.
ivector
(),
tensor
.
ivector
())
tensor
.
ivector
())
...
@@ -60,6 +62,8 @@ def test_local_csm_grad_c():
...
@@ -60,6 +62,8 @@ def test_local_csm_grad_c():
def
test_local_mul_s_d
():
def
test_local_mul_s_d
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
mode
=
theano
.
compile
.
mode
.
get_default_mode
()
mode
=
theano
.
compile
.
mode
.
get_default_mode
()
mode
=
mode
.
including
(
"specialize"
,
"local_mul_s_d"
)
mode
=
mode
.
including
(
"specialize"
,
"local_mul_s_d"
)
...
@@ -76,6 +80,8 @@ def test_local_mul_s_d():
...
@@ -76,6 +80,8 @@ def test_local_mul_s_d():
def
test_local_mul_s_v
():
def
test_local_mul_s_v
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
mode
=
theano
.
compile
.
mode
.
get_default_mode
()
mode
=
theano
.
compile
.
mode
.
get_default_mode
()
mode
=
mode
.
including
(
"specialize"
,
"local_mul_s_v"
)
mode
=
mode
.
including
(
"specialize"
,
"local_mul_s_v"
)
...
@@ -92,6 +98,8 @@ def test_local_mul_s_v():
...
@@ -92,6 +98,8 @@ def test_local_mul_s_v():
def
test_local_structured_add_s_v
():
def
test_local_structured_add_s_v
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
mode
=
theano
.
compile
.
mode
.
get_default_mode
()
mode
=
theano
.
compile
.
mode
.
get_default_mode
()
mode
=
mode
.
including
(
"specialize"
,
"local_structured_add_s_v"
)
mode
=
mode
.
including
(
"specialize"
,
"local_structured_add_s_v"
)
...
@@ -108,6 +116,8 @@ def test_local_structured_add_s_v():
...
@@ -108,6 +116,8 @@ def test_local_structured_add_s_v():
def
test_local_sampling_dot_csr
():
def
test_local_sampling_dot_csr
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
mode
=
theano
.
compile
.
mode
.
get_default_mode
()
mode
=
theano
.
compile
.
mode
.
get_default_mode
()
mode
=
mode
.
including
(
"specialize"
,
"local_sampling_dot_csr"
)
mode
=
mode
.
including
(
"specialize"
,
"local_sampling_dot_csr"
)
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
5ac06c76
...
@@ -4203,9 +4203,13 @@ class t_dot(unittest.TestCase):
...
@@ -4203,9 +4203,13 @@ class t_dot(unittest.TestCase):
e
[
0
]
.
split
()[
1
:
4
]
==
[
'are'
,
'not'
,
'aligned'
]
or
e
[
0
]
.
split
()[
1
:
4
]
==
[
'are'
,
'not'
,
'aligned'
]
or
# Reported by blas or Theano.
# Reported by blas or Theano.
e
[
0
]
.
split
()[
0
:
2
]
==
[
'Shape'
,
'mismatch:'
]
or
e
[
0
]
.
split
()[
0
:
2
]
==
[
'Shape'
,
'mismatch:'
]
or
# Reported by Theano perform
e
[
0
]
.
split
()[
0
:
4
]
==
[
'Incompatible'
,
'shapes'
,
'for'
,
'gemv'
]
or
# Reported by Theano when 'exception_verbosity' is set
# Reported by Theano when 'exception_verbosity' is set
# to 'high'.
# to 'high'.
e
[
0
]
.
split
()[
0
:
3
]
==
[
'dot'
,
'product'
,
'failed.'
],
e
[
0
]
.
split
()[
0
:
3
]
==
[
'dot'
,
'product'
,
'failed.'
]
,
e
)
e
)
finally
:
finally
:
_logger
.
setLevel
(
oldlevel
)
_logger
.
setLevel
(
oldlevel
)
...
@@ -5912,8 +5916,9 @@ def test_unalign():
...
@@ -5912,8 +5916,9 @@ def test_unalign():
f
.
maker
.
fgraph
.
toposort
()
f
.
maker
.
fgraph
.
toposort
()
# FAST_COMPILE use the python code that support unaligned data
# FAST_COMPILE use the python code that support unaligned data
# The DebugMode make a copy of the inputs, so they will be aligned.
# The DebugMode make a copy of the inputs, so they will be aligned.
should_raise
=
theano
.
config
.
mode
not
in
[
"FAST_COMPILE"
,
"DebugMode"
,
should_raise
=
(
theano
.
config
.
mode
not
in
[
"FAST_COMPILE"
,
"DebugMode"
,
"DEBUG_MODE"
]
"DEBUG_MODE"
]
and
theano
.
config
.
linker
!=
'py'
)
try
:
try
:
out_theano
=
f
(
a
,
b
)
out_theano
=
f
(
a
,
b
)
assert
not
a
.
flags
.
aligned
assert
not
a
.
flags
.
aligned
...
...
theano/tensor/tests/test_blas.py
浏览文件 @
5ac06c76
...
@@ -101,7 +101,8 @@ class t_gemm(TestCase):
...
@@ -101,7 +101,8 @@ class t_gemm(TestCase):
cmp_linker
(
copy
(
z
),
a
,
x
,
y
,
b
,
'c|py'
)
cmp_linker
(
copy
(
z
),
a
,
x
,
y
,
b
,
'c|py'
)
cmp_linker
(
copy
(
z
),
a
,
x
,
y
,
b
,
'py'
)
cmp_linker
(
copy
(
z
),
a
,
x
,
y
,
b
,
'py'
)
if
config
.
blas
.
ldflags
and
not
dtype
.
startswith
(
"complex"
):
if
(
config
.
blas
.
ldflags
and
not
dtype
.
startswith
(
"complex"
)
and
theano
.
config
.
cxx
):
# If blas.ldflags is equal to '', the C code will not
# If blas.ldflags is equal to '', the C code will not
# be generated
# be generated
cmp_linker
(
copy
(
z
),
a
,
x
,
y
,
b
,
'c'
)
cmp_linker
(
copy
(
z
),
a
,
x
,
y
,
b
,
'c'
)
...
...
theano/tensor/tests/test_elemwise.py
浏览文件 @
5ac06c76
...
@@ -5,6 +5,7 @@ import time
...
@@ -5,6 +5,7 @@ import time
import
unittest
import
unittest
import
numpy
import
numpy
from
nose.plugins.skip
import
SkipTest
from
numpy.testing
import
dec
from
numpy.testing
import
dec
import
theano
import
theano
...
@@ -166,15 +167,21 @@ class test_Broadcast(unittest.TestCase):
...
@@ -166,15 +167,21 @@ class test_Broadcast(unittest.TestCase):
self
.
with_linker
(
gof
.
PerformLinker
())
self
.
with_linker
(
gof
.
PerformLinker
())
def
test_c
(
self
):
def
test_c
(
self
):
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
self
.
with_linker
(
gof
.
CLinker
())
self
.
with_linker
(
gof
.
CLinker
())
def
test_perform_inplace
(
self
):
def
test_perform_inplace
(
self
):
self
.
with_linker_inplace
(
gof
.
PerformLinker
())
self
.
with_linker_inplace
(
gof
.
PerformLinker
())
def
test_c_inplace
(
self
):
def
test_c_inplace
(
self
):
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
self
.
with_linker_inplace
(
gof
.
CLinker
())
self
.
with_linker_inplace
(
gof
.
CLinker
())
def
test_fill
(
self
):
def
test_fill
(
self
):
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
x
=
TensorType
(
'float64'
,
[
0
,
0
])(
'x'
)
x
=
TensorType
(
'float64'
,
[
0
,
0
])(
'x'
)
y
=
TensorType
(
'float64'
,
[
1
,
1
])(
'y'
)
y
=
TensorType
(
'float64'
,
[
1
,
1
])(
'y'
)
e
=
Elemwise
(
scalar
.
Second
(
scalar
.
transfer_type
(
0
)),
{
0
:
0
})(
x
,
y
)
e
=
Elemwise
(
scalar
.
Second
(
scalar
.
transfer_type
(
0
)),
{
0
:
0
})(
x
,
y
)
...
@@ -185,6 +192,8 @@ class test_Broadcast(unittest.TestCase):
...
@@ -185,6 +192,8 @@ class test_Broadcast(unittest.TestCase):
assert
(
xv
==
yv
)
.
all
()
assert
(
xv
==
yv
)
.
all
()
def
test_weird_strides
(
self
):
def
test_weird_strides
(
self
):
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
x
=
TensorType
(
'float64'
,
[
0
,
0
,
0
,
0
,
0
])(
'x'
)
x
=
TensorType
(
'float64'
,
[
0
,
0
,
0
,
0
,
0
])(
'x'
)
y
=
TensorType
(
'float64'
,
[
0
,
0
,
0
,
0
,
0
])(
'y'
)
y
=
TensorType
(
'float64'
,
[
0
,
0
,
0
,
0
,
0
])(
'y'
)
e
=
Elemwise
(
scalar
.
add
)(
x
,
y
)
e
=
Elemwise
(
scalar
.
add
)(
x
,
y
)
...
@@ -195,6 +204,8 @@ class test_Broadcast(unittest.TestCase):
...
@@ -195,6 +204,8 @@ class test_Broadcast(unittest.TestCase):
assert
(
f
(
xv
,
yv
)
==
zv
)
.
all
()
assert
(
f
(
xv
,
yv
)
==
zv
)
.
all
()
def
test_same_inputs
(
self
):
def
test_same_inputs
(
self
):
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
x
=
TensorType
(
'float64'
,
[
0
,
0
])(
'x'
)
x
=
TensorType
(
'float64'
,
[
0
,
0
])(
'x'
)
e
=
Elemwise
(
scalar
.
add
)(
x
,
x
)
e
=
Elemwise
(
scalar
.
add
)(
x
,
x
)
f
=
gof
.
CLinker
()
.
accept
(
FunctionGraph
([
x
],
[
e
]))
.
make_function
()
f
=
gof
.
CLinker
()
.
accept
(
FunctionGraph
([
x
],
[
e
]))
.
make_function
()
...
@@ -374,6 +385,9 @@ class test_CAReduce(unittest_tools.InferShapeTester):
...
@@ -374,6 +385,9 @@ class test_CAReduce(unittest_tools.InferShapeTester):
test_nan
=
True
,
tensor_op
=
tensor
.
all
)
test_nan
=
True
,
tensor_op
=
tensor
.
all
)
def
test_c
(
self
):
def
test_c
(
self
):
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
for
dtype
in
[
"floatX"
,
"complex64"
,
"complex128"
,
"int8"
,
"uint8"
]:
for
dtype
in
[
"floatX"
,
"complex64"
,
"complex128"
,
"int8"
,
"uint8"
]:
self
.
with_linker
(
gof
.
CLinker
(),
scalar
.
add
,
dtype
=
dtype
)
self
.
with_linker
(
gof
.
CLinker
(),
scalar
.
add
,
dtype
=
dtype
)
self
.
with_linker
(
gof
.
CLinker
(),
scalar
.
mul
,
dtype
=
dtype
)
self
.
with_linker
(
gof
.
CLinker
(),
scalar
.
mul
,
dtype
=
dtype
)
...
@@ -390,6 +404,8 @@ class test_CAReduce(unittest_tools.InferShapeTester):
...
@@ -390,6 +404,8 @@ class test_CAReduce(unittest_tools.InferShapeTester):
self
.
with_linker
(
gof
.
CLinker
(),
scalar
.
xor
,
dtype
=
dtype
)
self
.
with_linker
(
gof
.
CLinker
(),
scalar
.
xor
,
dtype
=
dtype
)
def
test_c_nan
(
self
):
def
test_c_nan
(
self
):
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"G++ not available, so we need to skip this test."
)
for
dtype
in
[
"floatX"
,
"complex64"
,
"complex128"
]:
for
dtype
in
[
"floatX"
,
"complex64"
,
"complex128"
]:
self
.
with_linker
(
gof
.
CLinker
(),
scalar
.
add
,
dtype
=
dtype
,
self
.
with_linker
(
gof
.
CLinker
(),
scalar
.
add
,
dtype
=
dtype
,
test_nan
=
True
)
test_nan
=
True
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论