Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c331e558
提交
c331e558
authored
5月 06, 2008
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more conservative op.default_output
上级
e3dad04e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
10 行删除
+14
-10
graph.py
gof/graph.py
+10
-7
op.py
gof/op.py
+4
-3
没有找到文件。
gof/graph.py
浏览文件 @
c331e558
...
...
@@ -49,14 +49,17 @@ class Apply(object2):
Returns the default output for this Node, typically self.outputs[0].
Depends on the value of node.op.default_output
"""
do
=
self
.
op
.
default_output
if
do
<
0
:
raise
AttributeError
(
"
%
s does not have a default output."
%
self
.
op
)
elif
do
>
len
(
self
.
outputs
):
raise
AttributeError
(
"default output for
%
s is out of range."
%
self
.
op
)
do
=
getattr
(
self
.
op
,
'default_output'
,
None
)
if
do
is
None
:
if
len
(
self
.
outputs
)
==
1
:
return
self
.
outputs
[
0
]
else
:
raise
AttributeError
(
"
%
s.default_output should be an output index."
%
self
.
op
)
elif
do
<
0
or
do
>=
len
(
self
.
outputs
):
raise
AttributeError
(
"
%
s.default_output is out of range."
%
self
.
op
)
return
self
.
outputs
[
do
]
out
=
property
(
default_output
,
doc
=
"S
ame
as self.outputs[0] if this Op's has_default_output field is True."
)
doc
=
"S
hortcut to the
as self.outputs[0] if this Op's has_default_output field is True."
)
def
__str__
(
self
):
return
op_as_string
(
self
.
inputs
,
self
)
def
__repr__
(
self
):
...
...
@@ -561,7 +564,7 @@ def as_string(i, o,
if
r
.
owner
is
not
None
and
r
not
in
i
and
r
not
in
orph
:
op
=
r
.
owner
idx
=
op
.
outputs
.
index
(
r
)
if
idx
==
op
.
op
.
default_output
:
if
len
(
op
.
outputs
)
==
1
:
idxs
=
""
else
:
idxs
=
"::
%
i"
%
idx
...
...
gof/op.py
浏览文件 @
c331e558
...
...
@@ -12,10 +12,11 @@ from copy import copy
class
Op
(
object2
):
default_output
=
0
default_output
=
None
"""@todo
"""
#############
# make_node #
#############
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论