Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1e9b1f12
提交
1e9b1f12
authored
2月 25, 2011
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
white space fix.
上级
b6286137
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
19 行增加
和
19 行删除
+19
-19
op.py
theano/gof/op.py
+19
-19
没有找到文件。
theano/gof/op.py
浏览文件 @
1e9b1f12
...
@@ -42,10 +42,10 @@ class CLinkerObject(object):
...
@@ -42,10 +42,10 @@ class CLinkerObject(object):
Provide search paths for headers, in addition to those in any relevant environment
Provide search paths for headers, in addition to those in any relevant environment
variables.
variables.
Hint: for unix compilers, these are the things that get '-I' prefixed in the compiler
Hint: for unix compilers, these are the things that get '-I' prefixed in the compiler
cmdline.
cmdline.
:Exceptions:
:Exceptions:
- `MethodNotDefined`: Subclass does not implement this method
- `MethodNotDefined`: Subclass does not implement this method
...
@@ -78,10 +78,10 @@ class CLinkerObject(object):
...
@@ -78,10 +78,10 @@ class CLinkerObject(object):
Provide search paths for libraries, in addition to those in any relevant environment
Provide search paths for libraries, in addition to those in any relevant environment
variables (e.g. LD_LIBRARY_PATH).
variables (e.g. LD_LIBRARY_PATH).
Hint: for unix compilers, these are the things that get '-L' prefixed in the compiler
Hint: for unix compilers, these are the things that get '-L' prefixed in the compiler
cmdline.
cmdline.
:Exceptions:
:Exceptions:
- `MethodNotDefined`: Subclass does not implement this method
- `MethodNotDefined`: Subclass does not implement this method
...
@@ -148,9 +148,9 @@ class CLinkerObject(object):
...
@@ -148,9 +148,9 @@ class CLinkerObject(object):
def
c_no_compile_args
(
self
):
def
c_no_compile_args
(
self
):
"""Optional: Return a list of incompatible gcc compiler arguments.
"""Optional: Return a list of incompatible gcc compiler arguments.
We will remove those arguments from the command line of gcc. So if
We will remove those arguments from the command line of gcc. So if
another Op adds a compile arg in the graph that is incompatible
another Op adds a compile arg in the graph that is incompatible
with this Op, the incompatible arg will not be used.
with this Op, the incompatible arg will not be used.
Useful for instance to remove -ffast-math.
Useful for instance to remove -ffast-math.
EXAMPLE
EXAMPLE
...
@@ -178,7 +178,7 @@ class CLinkerOp(CLinkerObject):
...
@@ -178,7 +178,7 @@ class CLinkerOp(CLinkerObject):
Returns C code that does the computation associated to this `Op`,
Returns C code that does the computation associated to this `Op`,
given names for the inputs and outputs.
given names for the inputs and outputs.
:Parameters:
:Parameters:
`node` : Apply instance
`node` : Apply instance
WRITEME
WRITEME
...
@@ -207,8 +207,8 @@ class CLinkerOp(CLinkerObject):
...
@@ -207,8 +207,8 @@ class CLinkerOp(CLinkerObject):
QUESTION: is this function optional?
QUESTION: is this function optional?
This is a convenient place to clean up things allocated by c_code().
This is a convenient place to clean up things allocated by c_code().
:Parameters:
:Parameters:
`node` : Apply instance
`node` : Apply instance
WRITEME
WRITEME
...
@@ -224,7 +224,7 @@ class CLinkerOp(CLinkerObject):
...
@@ -224,7 +224,7 @@ class CLinkerOp(CLinkerObject):
`sub` : dict of strings
`sub` : dict of strings
extra symbols defined in `CLinker` sub symbols (such as 'fail').
extra symbols defined in `CLinker` sub symbols (such as 'fail').
WRITEME
WRITEME
WRITEME
WRITEME
:Exceptions:
:Exceptions:
...
@@ -256,11 +256,11 @@ class PureOp(object):
...
@@ -256,11 +256,11 @@ class PureOp(object):
An :term:`Op` is a type of operation.
An :term:`Op` is a type of operation.
`Op` is an abstract class that documents the interface for theano's data transformations.
`Op` is an abstract class that documents the interface for theano's data transformations.
It has many subclasses, such as
It has many subclasses, such as
`sparse dot <http://pylearn.org/epydoc/theano.sparse.Dot-class.html>`__,
`sparse dot <http://pylearn.org/epydoc/theano.sparse.Dot-class.html>`__,
and `Shape <http://pylearn.org/epydoc/theano.tensor.Shape-class.html>`__.
and `Shape <http://pylearn.org/epydoc/theano.tensor.Shape-class.html>`__.
These subclasses are meant to be instantiated.
These subclasses are meant to be instantiated.
An instance has several responsabilities:
An instance has several responsabilities:
- making `Apply` instances, which mean "apply this type of operation to some particular inputs" (via `make_node`),
- making `Apply` instances, which mean "apply this type of operation to some particular inputs" (via `make_node`),
...
@@ -278,7 +278,7 @@ class PureOp(object):
...
@@ -278,7 +278,7 @@ class PureOp(object):
"""
"""
default_output
=
None
default_output
=
None
"""
"""
configuration variable for `__call__`
configuration variable for `__call__`
A subclass should not change this class variable, but instead over-ride it with a subclass
A subclass should not change this class variable, but instead over-ride it with a subclass
...
@@ -304,7 +304,7 @@ class PureOp(object):
...
@@ -304,7 +304,7 @@ class PureOp(object):
raise
utils
.
MethodNotDefined
(
"make_node"
,
type
(
self
),
self
.
__class__
.
__name__
)
raise
utils
.
MethodNotDefined
(
"make_node"
,
type
(
self
),
self
.
__class__
.
__name__
)
def
__call__
(
self
,
*
inputs
,
**
kwargs
):
def
__call__
(
self
,
*
inputs
,
**
kwargs
):
"""Optional: Return some or all output[s] of `make_node`.
"""Optional: Return some or all output[s] of `make_node`.
It is called by code such as:
It is called by code such as:
...
@@ -313,8 +313,8 @@ class PureOp(object):
...
@@ -313,8 +313,8 @@ class PureOp(object):
x = tensor.matrix()
x = tensor.matrix()
# tensor.exp is an Op instance, calls Op.__call__(self=<instance of exp>, inputs=(x,))
# tensor.exp is an Op instance, calls Op.__call__(self=<instance of exp>, inputs=(x,))
y = tensor.exp(x)
y = tensor.exp(x)
This class implements a convenience function (for graph-building) which uses
This class implements a convenience function (for graph-building) which uses
`default_output`, but subclasses are free to override this function and ignore
`default_output`, but subclasses are free to override this function and ignore
`default_output`.
`default_output`.
...
@@ -344,7 +344,7 @@ class PureOp(object):
...
@@ -344,7 +344,7 @@ class PureOp(object):
output storage. Return None.
output storage. Return None.
:Parameters:
:Parameters:
`node` : Apply instance
`node` : Apply instance
contains the symbolic inputs and outputs
contains the symbolic inputs and outputs
`inputs` : list
`inputs` : list
sequence of inputs (immutable)
sequence of inputs (immutable)
...
@@ -362,6 +362,6 @@ class PureOp(object):
...
@@ -362,6 +362,6 @@ class PureOp(object):
"""
"""
raise
utils
.
MethodNotDefined
(
"perform"
,
type
(
self
),
self
.
__class__
.
__name__
)
raise
utils
.
MethodNotDefined
(
"perform"
,
type
(
self
),
self
.
__class__
.
__name__
)
class
Op
(
utils
.
object2
,
PureOp
,
CLinkerOp
):
class
Op
(
utils
.
object2
,
PureOp
,
CLinkerOp
):
"""Convenience class to bundle `PureOp` and `CLinkerOp`"""
"""Convenience class to bundle `PureOp` and `CLinkerOp`"""
pass
pass
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论