Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f1d27e59
提交
f1d27e59
authored
12月 16, 2008
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added the test fct test_shared_method
上级
9bf703a1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
52 行增加
和
3 行删除
+52
-3
test_module.py
theano/compile/tests/test_module.py
+52
-3
没有找到文件。
theano/compile/tests/test_module.py
浏览文件 @
f1d27e59
...
...
@@ -57,17 +57,29 @@ class T_test_module(unittest.TestCase):
m1
=
Module
()
m1
.
lx
=
[
x
]
#cast Result]
m1
.
ly
=
[
y
]
m1
.
llx
=
[[
x
]]
#cast Result]
m1
.
lly
=
[[
y
]]
m1
.
ltx
=
[(
x
,)]
m1
.
lty
=
[(
y
,)]
m1
.
dx
=
{
"x"
:
x
}
m1
.
dy
=
{
"y"
:
y
}
m1
.
tx
=
(
x
,)
m1
.
ty
=
(
y
,)
m1
.
ttx
=
((
x
,),)
m1
.
tty
=
((
y
,),)
m1
.
x
=
x
m1
.
y
=
y
inst
=
m1
.
make
()
assert
inst
.
lx
assert
inst
.
ly
assert
inst
.
llx
assert
inst
.
lly
assert
inst
.
ltx
assert
inst
.
lty
assert
inst
.
tx
assert
inst
.
ty
assert
inst
.
ttx
assert
inst
.
tty
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"
)
...
...
@@ -77,7 +89,6 @@ class T_test_module(unittest.TestCase):
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 IMPLEMENTED2"
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
...
...
@@ -123,8 +134,6 @@ class T_test_module(unittest.TestCase):
assert
isinstance
(
inst
.
tty
[
0
][
0
],
theano
.
compile
.
function_module
.
Function
)
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
is respected."""
...
...
@@ -213,6 +222,46 @@ class T_test_module(unittest.TestCase):
"""Test that under a variety of tricky conditions, the shared-ness of Results and Methods
is respected."""
#Fred: the test create different method event if they are shared. Do we want this?
m1
=
Module
()
m1
.
x
=
Member
(
T
.
dscalar
())
x
=
T
.
dscalar
()
fy
=
Method
(
x
,
x
*
2
)
fz
=
Method
([],
m1
.
x
*
2
)
m1
.
y
=
fy
m1
.
z
=
fz
m1
.
ly
=
[
fy
]
m1
.
lz
=
[
fz
]
m1
.
lly
=
[[
fy
]]
m1
.
llz
=
[[
fz
]]
m1
.
ty
=
(
fy
,)
m1
.
tz
=
(
fz
,)
m1
.
tty
=
((
fy
,),)
m1
.
ttz
=
((
fz
,),)
inst
=
m1
.
make
()
inst
.
x
=
1
assert
inst
.
y
(
2
)
==
4
assert
inst
.
z
()
==
2
assert
inst
.
ly
[
0
](
2
)
==
4
assert
inst
.
lz
[
0
]()
==
2
# assert inst.lly[0][0](2)==4#BUG: we don't support list of list of Method...
# assert inst.llz[0][0]()==2
assert
inst
.
ty
[
0
](
2
)
==
4
assert
inst
.
tz
[
0
]()
==
2
# assert inst.tty[0][0](2)==4
# assert inst.ttz[0][0]()==2
assert
isinstance
(
inst
.
z
,
theano
.
compile
.
function_module
.
Function
)
assert
isinstance
(
inst
.
lz
[
0
],
theano
.
compile
.
function_module
.
Function
)
# assert isinstance(inst.llz[0][0],theano.compile.function_module.Function)
assert
isinstance
(
inst
.
tz
[
0
],
theano
.
compile
.
function_module
.
Function
)
# assert isinstance(inst.ttz[0][0],theano.compile.function_module.Function)
assert
isinstance
(
inst
.
y
,
theano
.
compile
.
function_module
.
Function
)
assert
isinstance
(
inst
.
ly
[
0
],
theano
.
compile
.
function_module
.
Function
)
# assert isinstance(inst.lly[0][0],theano.compile.function_module.Function)
assert
isinstance
(
inst
.
ty
[
0
],
theano
.
compile
.
function_module
.
Function
)
# assert isinstance(inst.tty[0][0],theano.compile.function_module.Function)
print
>>
sys
.
stderr
,
"WARNING MODULE TEST NOT IMPLEMENTED"
#put them in subModules, sub-sub-Modules, shared between a list and a dict, shared between
#a list and a submodule with a dictionary, etc...
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论