Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7e4f583f
提交
7e4f583f
authored
5月 06, 2008
作者:
Olivier Breuleux
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
undeprecated gof.graph.inputs
上级
c331e558
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
9 行增加
和
40 行删除
+9
-40
_test_compile.py
_test_compile.py
+9
-0
_test_graph.py
gof/_test_graph.py
+0
-17
graph.py
gof/graph.py
+0
-23
没有找到文件。
_test_compile.py
浏览文件 @
7e4f583f
...
...
@@ -156,6 +156,15 @@ class T_Function(unittest.TestCase):
assert
eval_outputs
([
e
])
==
14.0
assert
fast_compute
(
e
)
==
14.0
def
test_closure
(
self
):
x
,
y
,
z
=
tensor
.
scalars
(
'xyz'
)
v
=
tensor
.
value
(
numpy
.
zeros
(()))
e
=
x
+
tensor
.
add_inplace
(
v
,
1
)
f
=
function
([
x
],
[
e
])
assert
f
(
1.
)
==
2.
assert
f
(
1.
)
==
3.
assert
f
(
1.
)
==
4.
def
test_borrow_true
(
self
):
x
,
y
,
z
=
tensor
.
scalars
(
'xyz'
)
e
=
x
+
y
+
z
...
...
gof/_test_graph.py
浏览文件 @
7e4f583f
...
...
@@ -7,23 +7,6 @@ from op import Op
from
type
import
Type
from
graph
import
Result
def
inputs
(
result_list
):
"""
@type result_list: list of L{Result}
@param result_list: output L{Result}s (from which to search backward through owners)
@returns: the list of L{Result}s with no owner, in the order found by a
left-recursive depth-first search started at the L{Result}s in result_list.
"""
def
expand
(
r
):
if
r
.
owner
:
l
=
list
(
r
.
owner
.
inputs
)
l
.
reverse
()
return
l
dfs_results
=
stack_search
(
deque
(
result_list
),
expand
,
'dfs'
)
rval
=
[
r
for
r
in
dfs_results
if
r
.
owner
is
None
]
#print rval, _orig_inputs(o)
return
rval
if
1
:
testcase
=
unittest
.
TestCase
...
...
gof/graph.py
浏览文件 @
7e4f583f
...
...
@@ -43,7 +43,6 @@ class Apply(object2):
self
.
outputs
.
append
(
output
)
else
:
raise
TypeError
(
"The 'outputs' argument to Apply must contain Result instances with no owner, not
%
s"
%
output
)
@deprecated
def
default_output
(
self
):
"""
Returns the default output for this Node, typically self.outputs[0].
...
...
@@ -165,27 +164,6 @@ def as_apply(x):
else
:
raise
TypeError
(
"Cannot map
%
s to Apply"
%
x
)
@deprecated
def
inputs
(
o
):
"""
@type o: list
@param o: output L{Result}s
Returns the set of inputs necessary to compute the outputs in o
such that input.owner is None.
"""
results
=
set
()
def
seek
(
r
):
op
=
r
.
owner
if
op
is
None
:
results
.
add
(
r
)
else
:
for
input
in
op
.
inputs
:
seek
(
input
)
for
output
in
o
:
seek
(
output
)
return
results
def
stack_search
(
start
,
expand
,
mode
=
'bfs'
,
build_inv
=
False
):
"""Search through L{Result}s, either breadth- or depth-first
@type start: deque
...
...
@@ -227,7 +205,6 @@ def stack_search(start, expand, mode='bfs', build_inv = False):
return
rval_list
@utils.deprecated
(
'gof.graph'
,
'is this function ever used?'
)
def
inputs
(
result_list
):
"""
@type result_list: list of L{Result}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论