Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c0225807
提交
c0225807
authored
4月 10, 2008
作者:
turian@grenat.iro.umontreal.ca
浏览文件
操作
浏览文件
下载
差异文件
merge
上级
63c6c486
82bc05c9
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
15 行删除
+18
-15
op.py
gof/op.py
+18
-15
没有找到文件。
gof/op.py
浏览文件 @
c0225807
...
...
@@ -101,9 +101,12 @@ class Op(object):
def
get_outputs
(
self
):
return
self
.
_outputs
def
set_outputs
(
self
,
new
):
# the point of this function is
# 1. to save the subclass's __init__ function always having to set the role of the outputs
# 2. to prevent accidentally re-setting outputs, which would probably be a bug
"""
The point of this function is:
1. to save the subclass's __init__ function always having to set the role of the outputs
2. to prevent accidentally re-setting outputs, which would probably be a bug
"""
if
not
hasattr
(
self
,
'_outputs'
)
or
self
.
_outputs
is
None
:
for
i
,
output
in
enumerate
(
new
):
output
.
role
=
(
self
,
i
)
...
...
@@ -122,10 +125,10 @@ class Op(object):
def
__copy__
(
self
):
"""
Shallow copy of this
Op
. The inputs are the exact same, but
Shallow copy of this
L{Op}
. The inputs are the exact same, but
the outputs are recreated because of the one-owner-per-result
policy. The default behavior is to call the constructor on
this
Op
's inputs.
this
L{Op}
's inputs.
To do a bottom-up copy of a graph, use clone_with_new_inputs.
"""
...
...
@@ -133,9 +136,9 @@ class Op(object):
def
clone_with_new_inputs
(
self
,
*
new_inputs
):
"""
Returns a clone of this
Op
that takes different inputs. The
Returns a clone of this
L{Op}
that takes different inputs. The
default behavior is to call the constructor on the new inputs,
but if your
Op
has additional options or a different constructor
but if your
L{Op}
has additional options or a different constructor
you might want to override this.
"""
return
self
.
__class__
(
*
new_inputs
)
...
...
@@ -158,10 +161,10 @@ class Op(object):
def
impl
(
self
,
*
args
):
"""Return output data [tuple], given input data
If this
Op
has a single output (len(self.outputs)==1) then the return
If this
L{Op}
has a single output (len(self.outputs)==1) then the return
value of this function will be assigned to self.outputs[0].data.
If this
Op
has multiple otuputs, then this function should return a
If this
L{Op}
has multiple otuputs, then this function should return a
tuple with the data for outputs[0], outputs[1], outputs[2], etc.
"""
raise
AbstractFunctionError
()
...
...
@@ -169,8 +172,8 @@ class Op(object):
def
perform
(
self
):
"""
Performs the computation associated to this
Op
and places the
result(s) in the output
Result
s.
Performs the computation associated to this
L{Op}
and places the
result(s) in the output
L{Result}
s.
TODO: consider moving this function to the python linker.
"""
...
...
@@ -231,27 +234,27 @@ class Op(object):
def
c_compile_args
(
self
):
"""
Return a list of compile args recommended to manipulate this
Op
.
Return a list of compile args recommended to manipulate this
L{Op}
.
"""
raise
AbstractFunctionError
()
def
c_headers
(
self
):
"""
Return a list of header files that must be included from C to manipulate
this
Op
.
this
L{Op}
.
"""
raise
AbstractFunctionError
()
def
c_libraries
(
self
):
"""
Return a list of libraries to link against to manipulate this
Op
.
Return a list of libraries to link against to manipulate this
L{Op}
.
"""
raise
AbstractFunctionError
()
def
c_support_code
(
self
):
"""
Return utility code for use by this Op. It may refer to support code
defined for its input
Result
s.
defined for its input
L{Result}
s.
"""
raise
AbstractFunctionError
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论