Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9d8d5f48
提交
9d8d5f48
authored
12月 16, 2008
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
差异文件
Automated merge with
ssh://projects@lgcm.iro.umontreal.ca/hg/theano
上级
a5a5cdc9
63c33ea3
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
70 行增加
和
7 行删除
+70
-7
test_module.py
theano/compile/tests/test_module.py
+70
-7
没有找到文件。
theano/compile/tests/test_module.py
浏览文件 @
9d8d5f48
...
...
@@ -17,14 +17,13 @@ class T_test_module(unittest.TestCase):
B
=
Blah
(
0.0
)
b
=
B
.
make
(
mode
=
'FAST_RUN'
)
b
.
step
(
1.0
)
print
b
.
stepsize
assert
b
.
stepsize
==
0.0
def
test_no_shared_members
(
self
):
"""Test that a Result cannot become a Member of two connected Modules
F
RED: What is the purpose of this test? Why we should not be able to do it?
Right now it seem to work when it should not.
F
red: What is the purpose of this test? Why we should not be able to do it? I think we should be able to share member.
Right now it seem to work when it should not.
"""
x
=
T
.
dscalar
()
y
=
Member
(
T
.
dscalar
())
...
...
@@ -35,8 +34,13 @@ class T_test_module(unittest.TestCase):
m1
.
y
=
y
m2
.
y
=
y
m2
.
m1
=
m1
m2
.
make
()
m1
.
make
()
inst1
=
m1
.
make
()
inst2
=
m2
.
make
()
# inst1.y=1
# inst2.y=2
print
inst1
print
inst2
print
>>
sys
.
stderr
,
"WARNING MODULE TEST NOT IMPLEMENTED1"
def
test_members_in_list_tuple_or_dict
(
self
):
...
...
@@ -45,6 +49,7 @@ class T_test_module(unittest.TestCase):
Fred: toplevel attribute? do you mean as a toplevel member? m1.x=x work as m1.lx=[x]?
Fred: why list,tuple of result are casted to member?
Fred: why no wrapper for dict? Should I add one?
Fred: why we don't promote a Result to a member, but we do it for lsit and tuple of results?
"""
def
local_test
(
x
,
y
):
...
...
@@ -75,8 +80,66 @@ class T_test_module(unittest.TestCase):
def
test_method_in_list_or_dict
(
self
):
"""Test that a Method which is only included via a list or dictionary is still treated as if it
were a toplevel attribute"""
print
>>
sys
.
stderr
,
"WARNING MODULE TEST NOT IMPLEMENTED"
were a toplevel attribute
Fred: why do we promote a list or tuple of fct of result to a Method?
Fred: why we don't do this of direct fct of results or dict?
"""
def
local_test
(
x
,
y
):
m1
=
Module
()
m1
.
lx
=
[
x
]
#cast Result to Member
m1
.
ly
=
[
y
]
#cast Result to Member
m1
.
dx
=
{
"x"
:
x
}
m1
.
dy
=
{
"y"
:
y
}
m1
.
tx
=
(
x
,)
#cast Result to Member
m1
.
ty
=
(
y
,)
#cast Result to Member
m1
.
x
=
x
m1
.
y
=
y
z
=
x
*
2
//
print
type
(
z
)
m1
.
z
=
z
m1
.
lz
=
[
z
]
m1
.
dz
=
{
"z"
:
z
}
m1
.
tz
=
(
z
,)
m1
.
zz1
=
Method
(
x
,
x
*
2
)
m1
.
zz2
=
m1
.
zz1
m1
.
lzz1
=
[
Method
(
x
,
x
*
2
)]
m1
.
lzz2
=
[
m1
.
zz1
]
m1
.
dzz1
=
{
"z"
:
m1
.
zz1
}
m1
.
dzz2
=
{
"z"
:
Method
(
x
,
x
*
2
)}
m1
.
tzz1
=
(
Method
(
x
,
x
*
2
),)
m1
.
tzz2
=
(
m1
.
zz1
,)
inst
=
m1
.
make
()
assert
inst
.
lx
assert
inst
.
ly
assert
inst
.
tx
assert
inst
.
ty
inst
.
y
# we don't assert just make the look up as with T.dscalar it return None
# but it don't return None for value and constant
self
.
assertRaises
(
AttributeError
,
inst
.
__getattr__
,
"x"
)
self
.
assertRaises
(
AttributeError
,
inst
.
__getattr__
,
"dx"
)
self
.
assertRaises
(
AttributeError
,
inst
.
__getattr__
,
"dy"
)
self
.
assertRaises
(
AttributeError
,
inst
.
__getattr__
,
"z"
)
self
.
assertRaises
(
AttributeError
,
inst
.
__getattr__
,
"lz"
)
self
.
assertRaises
(
AttributeError
,
inst
.
__getattr__
,
"dz"
)
self
.
assertRaises
(
AttributeError
,
inst
.
__getattr__
,
"tz"
)
self
.
assertRaises
(
AttributeError
,
inst
.
__getattr__
,
"dzz1"
)
self
.
assertRaises
(
AttributeError
,
inst
.
__getattr__
,
"dzz2"
)
print
m1
print
inst
assert
inst
.
zz1
(
2
)
assert
inst
.
zz2
(
2
)
assert
inst
.
lzz1
[
0
](
2
)
assert
inst
.
lzz2
[
0
](
2
)
assert
inst
.
tzz1
[
0
](
2
)
assert
inst
.
tzz2
[
0
](
2
)
local_test
(
T
.
dscalar
(),
Member
(
T
.
dscalar
()))
local_test
(
T
.
value
(
1
),
Member
(
T
.
value
(
2
)))
local_test
(
T
.
constant
(
1
),
Member
(
T
.
constant
(
2
)))
print
>>
sys
.
stderr
,
"WARNING MODULE TEST NOT IMPLEMENTED3"
def
test_shared_members
(
self
):
"""Test that under a variety of tricky conditions, the shared-ness of Results and Members
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论