Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
54bc8d12
提交
54bc8d12
authored
9月 30, 2014
作者:
Li
提交者:
Frederic
10月 21, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
addresses some of the cosmatic changes
上级
d4b03a78
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
25 行删除
+12
-25
test_graph_opt_caching.py
theano/tests/test_graph_opt_caching.py
+1
-18
test_pickle.py
theano/tests/test_pickle.py
+11
-7
没有找到文件。
theano/tests/test_graph_opt_caching.py
浏览文件 @
54bc8d12
...
@@ -5,14 +5,6 @@ from theano.gof.graph import is_same_graph
...
@@ -5,14 +5,6 @@ from theano.gof.graph import is_same_graph
from
theano.gof
import
FunctionGraph
from
theano.gof
import
FunctionGraph
from
theano.scan_module.scan_utils
import
equal_computations
from
theano.scan_module.scan_utils
import
equal_computations
def
graphs_equal
(
x
,
y
):
# check if two graphs are equal
# x: outputs list of graph A
# y: outputs list of graph B
pass
def
test_graph_equivalence
():
def
test_graph_equivalence
():
# Test if equivalent graphs are in fact equivalent
# Test if equivalent graphs are in fact equivalent
# by using some functions in Theano
# by using some functions in Theano
...
@@ -44,14 +36,5 @@ def test_graph_equivalence():
...
@@ -44,14 +36,5 @@ def test_graph_equivalence():
#assert graphs_equal(g1_y, g3_y) == True
#assert graphs_equal(g1_y, g3_y) == True
#assert graphs_equal(g1_y, g2_y) == False
#assert graphs_equal(g1_y, g2_y) == False
def
test_graph_optimization_caching
():
#
x
=
T
.
fmatrix
(
'inputs'
)
y
=
x
.
sum
()
f
=
theano
.
function
(
inputs
=
[
x
],
outputs
=
y
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test_graph_optimization_caching
()
test_graph_equivalence
()
#test_graph_equivalence()
theano/tests/test_pickle.py
浏览文件 @
54bc8d12
...
@@ -3,7 +3,7 @@ import theano
...
@@ -3,7 +3,7 @@ import theano
import
theano.tensor
as
T
import
theano.tensor
as
T
import
numpy
import
numpy
import
cPickle
import
cPickle
from
collections
import
OrderedDict
floatX
=
'float32'
floatX
=
'float32'
def
test_pickle_unpickle
():
def
test_pickle_unpickle
():
...
@@ -14,19 +14,23 @@ def test_pickle_unpickle():
...
@@ -14,19 +14,23 @@ def test_pickle_unpickle():
x3
=
theano
.
shared
(
numpy
.
ones
((
10
,
10
),
dtype
=
floatX
))
x3
=
theano
.
shared
(
numpy
.
ones
((
10
,
10
),
dtype
=
floatX
))
x4
=
theano
.
shared
(
numpy
.
ones
((
10
,
10
),
dtype
=
floatX
))
x4
=
theano
.
shared
(
numpy
.
ones
((
10
,
10
),
dtype
=
floatX
))
y
=
T
.
sum
(
T
.
sum
(
T
.
sum
(
x1
**
2
+
x2
)
+
x3
)
+
x4
)
y
=
T
.
sum
(
T
.
sum
(
T
.
sum
(
x1
**
2
+
x2
)
+
x3
)
+
x4
)
f
=
theano
.
function
([
x1
,
x2
],
y
)
updates
=
OrderedDict
()
updates
[
x3
]
=
x3
+
1
updates
[
x4
]
=
x4
+
1
f
=
theano
.
function
([
x1
,
x2
],
y
,
updates
=
updates
)
pkl_path
=
open
(
'thean_fn.pkl'
,
'wb'
)
pkl_path
=
open
(
'thean_fn.pkl'
,
'wb'
)
cPickle
.
dump
(
f
,
pkl_path
,
-
1
)
cPickle
.
dump
(
f
,
pkl_path
,
-
1
)
pkl_path
=
open
(
'thean_fn.pkl'
,
'r'
)
pkl_path
=
open
(
'thean_fn.pkl'
,
'r'
)
f_
=
cPickle
.
load
(
pkl_path
)
f_
=
cPickle
.
load
(
pkl_path
)
in1
=
numpy
.
ones
((
10
,
10
),
dtype
=
floatX
)
in1
=
numpy
.
ones
((
10
,
10
),
dtype
=
floatX
)
in2
=
numpy
.
ones
((
10
,
10
),
dtype
=
floatX
)
in2
=
numpy
.
ones
((
10
,
10
),
dtype
=
floatX
)
assert
f
(
in1
,
in2
)
==
f_
(
in1
,
in2
)
assert
f
(
in1
,
in2
)
==
f_
(
in1
,
in2
)
print
f
(
in1
,
in2
)
print
f
(
in1
,
in2
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test_pickle_unpickle
()
test_pickle_unpickle
()
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论