Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b7a21266
提交
b7a21266
authored
11月 21, 2013
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1616 from nouiz/err_msg
Better error message for theano.tensor.{all,any}({True,False})
上级
2ef1058b
93b931bd
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
24 行增加
和
6 行删除
+24
-6
test_cmodule.py
theano/gof/tests/test_cmodule.py
+2
-2
test_lazy.py
theano/gof/tests/test_lazy.py
+4
-1
elemwise.py
theano/tensor/elemwise.py
+2
-0
test_conv.py
theano/tensor/nnet/tests/test_conv.py
+4
-2
test_conv3d2d.py
theano/tensor/nnet/tests/test_conv3d2d.py
+8
-1
test_opt.py
theano/tensor/tests/test_opt.py
+4
-0
没有找到文件。
theano/gof/tests/test_cmodule.py
浏览文件 @
b7a21266
...
@@ -44,7 +44,7 @@ def test_inter_process_cache():
...
@@ -44,7 +44,7 @@ def test_inter_process_cache():
x
,
y
=
theano
.
tensor
.
dvectors
(
'xy'
)
x
,
y
=
theano
.
tensor
.
dvectors
(
'xy'
)
f
=
theano
.
function
([
x
,
y
],
[
MyOp
()(
x
),
MyOp
()(
y
)])
f
=
theano
.
function
([
x
,
y
],
[
MyOp
()(
x
),
MyOp
()(
y
)])
f
(
numpy
.
arange
(
60
),
numpy
.
arange
(
60
))
f
(
numpy
.
arange
(
60
),
numpy
.
arange
(
60
))
if
theano
.
config
.
mode
==
'FAST_COMPILE'
:
if
theano
.
config
.
mode
==
'FAST_COMPILE'
or
theano
.
config
.
cxx
==
""
:
assert
MyOp
.
nb_called
==
0
assert
MyOp
.
nb_called
==
0
else
:
else
:
assert
MyOp
.
nb_called
==
1
assert
MyOp
.
nb_called
==
1
...
@@ -53,7 +53,7 @@ def test_inter_process_cache():
...
@@ -53,7 +53,7 @@ def test_inter_process_cache():
x
,
y
=
theano
.
tensor
.
dvectors
(
'xy'
)
x
,
y
=
theano
.
tensor
.
dvectors
(
'xy'
)
f
=
theano
.
function
([
x
,
y
],
[
MyOp
()(
x
),
MyOp
()(
y
)])
f
=
theano
.
function
([
x
,
y
],
[
MyOp
()(
x
),
MyOp
()(
y
)])
f
(
numpy
.
arange
(
60
),
numpy
.
arange
(
60
))
f
(
numpy
.
arange
(
60
),
numpy
.
arange
(
60
))
if
theano
.
config
.
mode
==
'FAST_COMPILE'
:
if
theano
.
config
.
mode
==
'FAST_COMPILE'
or
theano
.
config
.
cxx
==
""
:
assert
MyOp
.
nb_called
==
0
assert
MyOp
.
nb_called
==
0
else
:
else
:
assert
MyOp
.
nb_called
==
1
assert
MyOp
.
nb_called
==
1
theano/gof/tests/test_lazy.py
浏览文件 @
b7a21266
...
@@ -110,7 +110,10 @@ def test_ifelse():
...
@@ -110,7 +110,10 @@ def test_ifelse():
# We need lazy to end up being True for this test.
# We need lazy to end up being True for this test.
if
theano
.
config
.
vm
.
lazy
in
[
True
,
None
]:
if
theano
.
config
.
vm
.
lazy
in
[
True
,
None
]:
lazys
=
[
True
,
None
]
lazys
=
[
True
,
None
]
for
cloop
in
[
True
,
False
]:
cloops
=
[
True
,
False
]
if
theano
.
config
.
cxx
==
""
:
cloops
=
[
False
]
for
cloop
in
cloops
:
for
lazy
in
lazys
:
for
lazy
in
lazys
:
linker
=
theano
.
gof
.
vm
.
VM_Linker
(
use_cloop
=
cloop
,
lazy
=
lazy
)
linker
=
theano
.
gof
.
vm
.
VM_Linker
(
use_cloop
=
cloop
,
lazy
=
lazy
)
f
=
function
([
a
,
b
,
c
],
ifelse
(
a
,
notimpl
(
b
),
c
),
f
=
function
([
a
,
b
,
c
],
ifelse
(
a
,
notimpl
(
b
),
c
),
...
...
theano/tensor/elemwise.py
浏览文件 @
b7a21266
...
@@ -1606,6 +1606,7 @@ class All(CAReduce):
...
@@ -1606,6 +1606,7 @@ class All(CAReduce):
return
"All{
%
s}"
%
", "
.
join
(
map
(
str
,
self
.
axis
))
return
"All{
%
s}"
%
", "
.
join
(
map
(
str
,
self
.
axis
))
def
make_node
(
self
,
input
):
def
make_node
(
self
,
input
):
input
=
as_tensor_variable
(
input
)
if
input
.
dtype
not
in
[
"int8"
,
"uint8"
]:
if
input
.
dtype
not
in
[
"int8"
,
"uint8"
]:
input
=
theano
.
tensor
.
neq
(
input
,
0
)
input
=
theano
.
tensor
.
neq
(
input
,
0
)
ret
=
super
(
All
,
self
)
.
make_node
(
input
)
ret
=
super
(
All
,
self
)
.
make_node
(
input
)
...
@@ -1631,6 +1632,7 @@ class Any(CAReduce):
...
@@ -1631,6 +1632,7 @@ class Any(CAReduce):
return
"Any{
%
s}"
%
", "
.
join
(
map
(
str
,
self
.
axis
))
return
"Any{
%
s}"
%
", "
.
join
(
map
(
str
,
self
.
axis
))
def
make_node
(
self
,
input
):
def
make_node
(
self
,
input
):
input
=
as_tensor_variable
(
input
)
if
input
.
dtype
not
in
[
"int8"
,
"uint8"
]:
if
input
.
dtype
not
in
[
"int8"
,
"uint8"
]:
input
=
theano
.
tensor
.
neq
(
input
,
0
)
input
=
theano
.
tensor
.
neq
(
input
,
0
)
ret
=
super
(
Any
,
self
)
.
make_node
(
input
)
ret
=
super
(
Any
,
self
)
.
make_node
(
input
)
...
...
theano/tensor/nnet/tests/test_conv.py
浏览文件 @
b7a21266
import
time
import
time
from
nose.plugins.skip
import
SkipTest
import
numpy
import
numpy
import
theano
import
theano
import
theano.tensor
as
T
import
theano.tensor
as
T
from
theano.tests
import
unittest_tools
as
utt
from
theano.tests
import
unittest_tools
as
utt
from
theano.tensor.nnet
import
conv
from
theano.tensor.nnet
import
conv
from
theano.tensor.basic
import
_allclose
,
NotScalarConstantError
from
theano.tensor.basic
import
_allclose
,
NotScalarConstantError
...
@@ -18,6 +18,8 @@ class TestConv2D(utt.InferShapeTester):
...
@@ -18,6 +18,8 @@ class TestConv2D(utt.InferShapeTester):
self
.
input
.
name
=
'default_V'
self
.
input
.
name
=
'default_V'
self
.
filters
=
T
.
dtensor4
(
'filters'
)
self
.
filters
=
T
.
dtensor4
(
'filters'
)
self
.
filters
.
name
=
'default_filters'
self
.
filters
.
name
=
'default_filters'
if
not
conv
.
imported_scipy_signal
and
theano
.
config
.
cxx
==
""
:
raise
SkipTest
(
"conv2d tests need SciPy or a c++ compiler"
)
def
validate
(
self
,
image_shape
,
filter_shape
,
def
validate
(
self
,
image_shape
,
filter_shape
,
border_mode
=
'valid'
,
subsample
=
(
1
,
1
),
border_mode
=
'valid'
,
subsample
=
(
1
,
1
),
...
...
theano/tensor/nnet/tests/test_conv3d2d.py
浏览文件 @
b7a21266
import
time
import
time
from
nose.plugins.skip
import
SkipTest
import
numpy
import
numpy
from
scipy
import
ndimage
try
:
from
scipy
import
ndimage
except
ImportError
:
ndimage
=
None
import
theano
import
theano
from
theano.tensor.nnet.conv3d2d
import
*
from
theano.tensor.nnet.conv3d2d
import
*
import
theano.tests.unittest_tools
as
utt
import
theano.tests.unittest_tools
as
utt
...
@@ -67,6 +72,8 @@ def pyconv3d(signals, filters):
...
@@ -67,6 +72,8 @@ def pyconv3d(signals, filters):
def
test_conv3d
(
mode
=
mode_without_gpu
,
shared
=
theano
.
tensor
.
_shared
):
def
test_conv3d
(
mode
=
mode_without_gpu
,
shared
=
theano
.
tensor
.
_shared
):
if
ndimage
is
None
:
raise
SkipTest
(
"conv3d2d tests need SciPy"
)
Ns
,
Ts
,
C
,
Hs
,
Ws
=
3
,
10
,
3
,
32
,
32
Ns
,
Ts
,
C
,
Hs
,
Ws
=
3
,
10
,
3
,
32
,
32
Nf
,
Tf
,
C
,
Hf
,
Wf
=
32
,
5
,
3
,
5
,
5
Nf
,
Tf
,
C
,
Hf
,
Wf
=
32
,
5
,
3
,
5
,
5
...
...
theano/tensor/tests/test_opt.py
浏览文件 @
b7a21266
...
@@ -3140,6 +3140,8 @@ class T_local_erf(unittest.TestCase):
...
@@ -3140,6 +3140,8 @@ class T_local_erf(unittest.TestCase):
self
.
mode
=
theano
.
compile
.
mode
.
get_default_mode
()
.
including
(
self
.
mode
=
theano
.
compile
.
mode
.
get_default_mode
()
.
including
(
'canonicalize'
,
'fast_run'
)
.
excluding
(
'gpu'
,
'fusion'
)
'canonicalize'
,
'fast_run'
)
.
excluding
(
'gpu'
,
'fusion'
)
self
.
mode
.
_optimizer
.
position_cutoff
=
1.50001
self
.
mode
.
_optimizer
.
position_cutoff
=
1.50001
if
theano
.
config
.
cxx
==
''
and
not
theano
.
scalar
.
basic_scipy
.
imported_scipy_special
:
raise
SkipTest
(
"erf need a c++ compiler or scipy"
)
def
test_local_one_plus_erf
(
self
):
def
test_local_one_plus_erf
(
self
):
val
=
numpy
.
asarray
([
-
30
,
-
3
,
-
2
,
-
1
,
0
,
1
,
2
,
3
,
30
],
val
=
numpy
.
asarray
([
-
30
,
-
3
,
-
2
,
-
1
,
0
,
1
,
2
,
3
,
30
],
...
@@ -3237,6 +3239,8 @@ class T_local_erfc(unittest.TestCase):
...
@@ -3237,6 +3239,8 @@ class T_local_erfc(unittest.TestCase):
'canonicalize'
)
.
including
(
'fast_run'
)
.
excluding
(
'gpu'
)
'canonicalize'
)
.
including
(
'fast_run'
)
.
excluding
(
'gpu'
)
self
.
mode
=
self
.
mode_fusion
.
excluding
(
'fusion'
)
self
.
mode
=
self
.
mode_fusion
.
excluding
(
'fusion'
)
self
.
mode
.
_optimizer
.
position_cutoff
=
1.50001
self
.
mode
.
_optimizer
.
position_cutoff
=
1.50001
if
theano
.
config
.
cxx
==
''
and
not
theano
.
scalar
.
basic_scipy
.
imported_scipy_special
:
raise
SkipTest
(
"erfc need a c++ compiler or scipy"
)
def
test_local_one_minus_erfc
(
self
):
def
test_local_one_minus_erfc
(
self
):
""" test opt: 1-erfc(x) => erf(x) and -erfc(x)+1 => erf(x)
""" test opt: 1-erfc(x) => erf(x) and -erfc(x)+1 => erf(x)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论