Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
eba4c9ab
提交
eba4c9ab
authored
8月 09, 2011
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added know failure test about CAReduce with nan in inputs. Put this in NEWS.txt
They don't generate the good output.
上级
27d2b072
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
51 行增加
和
2 行删除
+51
-2
NEWS.txt
NEWS.txt
+6
-0
test_elemwise.py
theano/tensor/tests/test_elemwise.py
+45
-2
没有找到文件。
NEWS.txt
浏览文件 @
eba4c9ab
...
@@ -6,6 +6,12 @@ Interface change:
...
@@ -6,6 +6,12 @@ Interface change:
This is an interface change outside the normal release number scheme. We need
This is an interface change outside the normal release number scheme. We need
this for pylearn2 and waiting for a futur release is not a good solution.
this for pylearn2 and waiting for a futur release is not a good solution.
Know bug:
* CAReduce with nan in inputs don't return the good output.
* This is used in tensor.{max,sum,mean} and in the grad of PermuteRowElements.
* This is not a new bug, just a bug discovered since the last release that we didn't had time to fix.
* Ticket: http://trac-hg.assembla.com/theano/ticket/763
Deprecation (will be removed in Theano 0.5):
Deprecation (will be removed in Theano 0.5):
* The string mode (accepted only by theano.function()) FAST_RUN_NOGC. Use Mode(linker='c|py_nogc') instead.
* The string mode (accepted only by theano.function()) FAST_RUN_NOGC. Use Mode(linker='c|py_nogc') instead.
...
...
theano/tensor/tests/test_elemwise.py
浏览文件 @
eba4c9ab
import
cPickle
,
time
,
unittest
import
cPickle
,
time
,
unittest
from
numpy.testing
import
dec
from
theano.gof
import
Variable
,
Op
from
theano.gof
import
Variable
,
Op
from
theano
import
gof
from
theano
import
gof
...
@@ -171,7 +173,8 @@ class test_CAReduce(unittest.TestCase):
...
@@ -171,7 +173,8 @@ class test_CAReduce(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
unittest_tools
.
seed_rng
()
unittest_tools
.
seed_rng
()
def
with_linker
(
self
,
linker
,
scalar_op
=
add
,
dtype
=
"floatX"
):
def
with_linker
(
self
,
linker
,
scalar_op
=
add
,
dtype
=
"floatX"
,
test_nan
=
False
):
for
xsh
,
tosum
in
[((
5
,
6
),
None
),
for
xsh
,
tosum
in
[((
5
,
6
),
None
),
((
5
,
6
),
(
0
,
1
)),
((
5
,
6
),
(
0
,
1
)),
((
5
,
6
),
(
0
,
)),
((
5
,
6
),
(
0
,
)),
...
@@ -199,6 +202,14 @@ class test_CAReduce(unittest.TestCase):
...
@@ -199,6 +202,14 @@ class test_CAReduce(unittest.TestCase):
xv
=
numpy
.
asarray
(
xv
,
dtype
=
dtype
)
xv
=
numpy
.
asarray
(
xv
,
dtype
=
dtype
)
else
:
else
:
xv
=
numpy
.
asarray
(
xv
<
0.5
,
dtype
=
dtype
)
xv
=
numpy
.
asarray
(
xv
<
0.5
,
dtype
=
dtype
)
if
test_nan
and
xv
.
size
>
0
:
if
len
(
xsh
)
>
0
:
xv
=
xv
.
flatten
()
xv
[
0
]
=
numpy
.
nan
xv
=
xv
.
reshape
(
*
xsh
)
else
:
xv
=
numpy
.
asarray
(
numpy
.
nan
,
dtype
=
dtype
)
zv
=
xv
zv
=
xv
numpy_raised
=
False
numpy_raised
=
False
if
len
(
tosum
)
>
1
and
any
([
a
<
0
for
a
in
tosum
]):
if
len
(
tosum
)
>
1
and
any
([
a
<
0
for
a
in
tosum
]):
...
@@ -255,7 +266,10 @@ class test_CAReduce(unittest.TestCase):
...
@@ -255,7 +266,10 @@ class test_CAReduce(unittest.TestCase):
#numpy.{all,any} return bool type.
#numpy.{all,any} return bool type.
if
scalar_op
in
[
and_
,
or_
]:
if
scalar_op
in
[
and_
,
or_
]:
zv
=
numpy
.
asarray
(
zv
,
dtype
=
dtype
)
zv
=
numpy
.
asarray
(
zv
,
dtype
=
dtype
)
self
.
assertTrue
(
numpy
.
allclose
(
f
(
xv
),
zv
))
if
test_nan
:
self
.
assertTrue
(
theano
.
tensor
.
TensorType
.
values_eq
(
f
(
xv
),
zv
),
(
f
(
xv
),
zv
))
else
:
self
.
assertTrue
(
numpy
.
allclose
(
f
(
xv
),
zv
),
(
f
(
xv
),
zv
))
#test CAReduce.infer_shape
#test CAReduce.infer_shape
...
@@ -279,6 +293,20 @@ class test_CAReduce(unittest.TestCase):
...
@@ -279,6 +293,20 @@ class test_CAReduce(unittest.TestCase):
self
.
with_linker
(
gof
.
PerformLinker
(),
and_
,
dtype
=
dtype
)
self
.
with_linker
(
gof
.
PerformLinker
(),
and_
,
dtype
=
dtype
)
self
.
with_linker
(
gof
.
PerformLinker
(),
xor
,
dtype
=
dtype
)
self
.
with_linker
(
gof
.
PerformLinker
(),
xor
,
dtype
=
dtype
)
@dec.knownfailureif
(
True
,
(
"When there is nan in the input of CAReduce, we don't have a good output. "
))
def
test_perform_nan
(
self
):
for
dtype
in
[
"floatX"
,
"complex64"
,
"complex128"
]:
self
.
with_linker
(
gof
.
PerformLinker
(),
add
,
dtype
=
dtype
,
test_nan
=
True
)
self
.
with_linker
(
gof
.
PerformLinker
(),
mul
,
dtype
=
dtype
,
test_nan
=
True
)
self
.
with_linker
(
gof
.
PerformLinker
(),
maximum
,
dtype
=
dtype
,
test_nan
=
True
)
self
.
with_linker
(
gof
.
PerformLinker
(),
minimum
,
dtype
=
dtype
,
test_nan
=
True
)
def
test_c
(
self
):
def
test_c
(
self
):
for
dtype
in
[
"floatX"
,
"complex64"
,
"complex128"
,
"int8"
,
"uint8"
]:
for
dtype
in
[
"floatX"
,
"complex64"
,
"complex128"
,
"int8"
,
"uint8"
]:
self
.
with_linker
(
gof
.
CLinker
(),
add
,
dtype
=
dtype
)
self
.
with_linker
(
gof
.
CLinker
(),
add
,
dtype
=
dtype
)
...
@@ -291,6 +319,21 @@ class test_CAReduce(unittest.TestCase):
...
@@ -291,6 +319,21 @@ class test_CAReduce(unittest.TestCase):
self
.
with_linker
(
gof
.
CLinker
(),
and_
,
dtype
=
dtype
)
self
.
with_linker
(
gof
.
CLinker
(),
and_
,
dtype
=
dtype
)
self
.
with_linker
(
gof
.
CLinker
(),
xor
,
dtype
=
dtype
)
self
.
with_linker
(
gof
.
CLinker
(),
xor
,
dtype
=
dtype
)
@dec.knownfailureif
(
True
,
(
"When there is nan in the input of CAReduce, we don't have a good output. "
))
def
test_c_nan
(
self
):
for
dtype
in
[
"floatX"
,
"complex64"
,
"complex128"
]:
self
.
with_linker
(
gof
.
CLinker
(),
add
,
dtype
=
dtype
,
test_nan
=
True
)
self
.
with_linker
(
gof
.
CLinker
(),
mul
,
dtype
=
dtype
,
test_nan
=
True
)
for
dtype
in
[
"floatX"
]:
self
.
with_linker
(
gof
.
CLinker
(),
minimum
,
dtype
=
dtype
,
test_nan
=
True
)
self
.
with_linker
(
gof
.
CLinker
(),
maximum
,
dtype
=
dtype
,
test_nan
=
True
)
class
test_Prod
(
unittest
.
TestCase
):
class
test_Prod
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论