Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
640f8956
提交
640f8956
authored
4月 09, 2014
作者:
Li
提交者:
Frederic
10月 21, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test case for graph caching
上级
795ded70
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
59 行增加
和
0 行删除
+59
-0
function_module.py
theano/compile/function_module.py
+1
-0
fg.py
theano/gof/fg.py
+5
-0
graph.py
theano/gof/graph.py
+1
-0
test_graph_opt_caching.py
theano/tests/test_graph_opt_caching.py
+52
-0
没有找到文件。
theano/compile/function_module.py
浏览文件 @
640f8956
...
...
@@ -1068,6 +1068,7 @@ class FunctionMaker(object):
theano
.
config
.
compute_test_value
=
theano
.
config
.
compute_test_value_opt
gof
.
Op
.
add_stack_trace_on_call
=
False
start_optimizer
=
time
.
time
()
import
ipdb
;
ipdb
.
set_trace
()
optimizer_profile
=
optimizer
(
fgraph
)
end_optimizer
=
time
.
time
()
opt_time
=
end_optimizer
-
start_optimizer
...
...
theano/gof/fg.py
浏览文件 @
640f8956
...
...
@@ -87,6 +87,11 @@ class FunctionGraph(utils.object2):
#TODO: document what variables are[not] set in the FunctionGraph when a feature
is added via the constructor. How constructed is the FunctionGraph?
Note: the intermediate nodes between 'inputs' and 'outputs' are not explicitely
passed.
:param inputs: inputs nodes of the graph, usually declared by the user
:param outputs: outputs nodes of the graph.
:param clone: If true, we will clone the graph. This is
useful to remove the constant cache problem.
...
...
theano/gof/graph.py
浏览文件 @
640f8956
...
...
@@ -873,6 +873,7 @@ def is_same_graph(var1, var2, givens=None, debug=False):
# Get result from the merge-based function.
rval1
=
is_same_graph_with_merge
(
var1
=
var1
,
var2
=
var2
,
givens
=
givens
)
# Get result from the function `equal_computations` from scan_utils.
import
ipdb
;
ipdb
.
set_trace
()
use_equal_computations
=
True
if
givens
:
# We need to build the `in_xs` and `in_ys` lists. To do this, we need
...
...
theano/tests/test_graph_opt_caching.py
0 → 100644
浏览文件 @
640f8956
import
unittest
import
theano
import
theano.tensor
as
T
from
theano.gof.graph
import
is_same_graph
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
import
ipdb
;
ipdb
.
set_trace
()
while
True
:
pass
def
test_graph_equivalence
():
# Test if equivalent graphs are in fact equivalent
# by using some functions in Theano
# graph g1
g1_a
=
T
.
fmatrix
(
'inputs'
)
g1_b
=
T
.
fmatrix
(
'inputs'
)
g1_y
=
T
.
sum
(
g1_a
+
g1_b
)
g1_yy
=
T
.
sum
(
g1_a
+
g1_b
)
g2_x
=
T
.
fmatrix
(
'inputs'
)
g2_y
=
g2_x
.
sum
()
g3_a
=
T
.
fmatrix
(
'inputs'
)
g3_b
=
T
.
fmatrix
(
'inputs'
)
g3_y
=
T
.
sum
(
g3_a
+
g3_b
)
assert
is_same_graph
(
g1_y
,
g2_y
)
==
False
# This does not work.
assert
is_same_graph
(
g1_y
,
g1_y
)
assert
is_same_graph
(
g1_y
,
g1_yy
)
assert
is_same_graph
(
g1_y
,
g3_y
,
givens
=
{
g1_a
:
g3_a
,
g1_b
:
g3_b
})
FunctionGraph
([],
g1_y
)
#assert graphs_equal(g1_y, g3_y) == True
#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__'
:
#test_graph_optimization_caching()
test_graph_equivalence
()
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论