Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0d4f392c
提交
0d4f392c
authored
9月 23, 2008
作者:
james@crane
浏览文件
操作
浏览文件
下载
差异文件
merged
上级
344bb891
be9e4498
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
46 行增加
和
38 行删除
+46
-38
__init__.py
__init__.py
+18
-2
doc.idx
doc/doc.idx
+4
-4
op.py
gof/op.py
+13
-22
local.epydoc
local.epydoc
+3
-7
wiki.idx
wiki.idx
+8
-3
没有找到文件。
__init__.py
浏览文件 @
0d4f392c
"""
"""
WRITEME: Some module-level documentation.
Theano is an optimizing compiler in Python, built to evaluate complicated expressions
(especially matrix-valued ones) as quickly as possible.
Theano compiles expression graphs (see :doc:`graph` ) that are built by Python code.
The expressions in these graphs are called `Apply` nodes and the variables in these graphs are called `Result` nodes.
Here is how to make a link into the wiki: check out the :wiki:`DefineGraph()`.
You compile a graph by calling `function`, which takes a graph, and returns a callable object.
One of theano's most important features is that `function` can transform your graph before
compiling it.
It can replace simple expressions with faster or more numerically stable implementations.
To learn more, check out:
- Joseph Turian's n00b walk through ( :wiki:`UserBasic` )
- an introduction to extending theano ( :wiki:`UserAdvanced` )
- Terminology Glossary (:wiki:`glossary`)
- Index of Howto documents (:wiki:`IndexHowto`)
"""
"""
...
...
doc/doc.idx
浏览文件 @
0d4f392c
graph
/
graph.html
graph graph.html
tensor
/
graph.html
tensor graph.html
result
/
graph.html
result graph.html
howto
/
graph.html
howto graph.html
gof/op.py
浏览文件 @
0d4f392c
"""
Defines base clases `Op` and `Op_clinker`.
"""
Defines base classes `Op`, `PureOp`, and `CLinkerOp`
The `Op` class is the base interface for all operations
The `Op` class is the base interface for all operations
compatible with `gof`'s :doc:`graph` routines.
compatible with `gof`'s :doc:`graph` routines.
"""
"""
__docformat__
=
"restructuredtext en"
__docformat__
=
"restructuredtext en"
...
@@ -11,20 +12,20 @@ import utils
...
@@ -11,20 +12,20 @@ import utils
import
traceback
import
traceback
class
Op_clinker
(
utils
.
object2
):
class
CLinkerOp
(
object
):
"""
"""
Interface definition for `Op` subclasses compiled by `CLinker`.
Interface definition for `Op` subclasses compiled by `CLinker`.
A subclass should implement
A subclass should implement
WRITEME.
WRITEME: structure of automatically generated C code.
WRITEME: structure of automatically generated C code.
Put this in doc/code_structure.txt
"""
"""
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
"""Required: Return the C implementation of an Op.
"""Required: Return the C implementation of an Op.
Returns C code that does the computation associated to this
L{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:
...
@@ -137,15 +138,7 @@ class Op_clinker(utils.object2):
...
@@ -137,15 +138,7 @@ class Op_clinker(utils.object2):
"""
"""
raise
utils
.
AbstractFunctionError
()
raise
utils
.
AbstractFunctionError
()
class
PureOp
(
object
):
#TODO:
# This is a somewhat ugly use of inheritance because Op is an abstract interface that has
# nothing to do with code generation.
#
# Better would be for Op subclasses wanting to work with the CLinker to have a second
# inheritance from Op_clinker.
class
Op
(
Op_clinker
):
"""
"""
An :term:`Op` is a type of operation.
An :term:`Op` is a type of operation.
...
@@ -161,9 +154,6 @@ class Op(Op_clinker):
...
@@ -161,9 +154,6 @@ class Op(Op_clinker):
- performing the calculation of outputs from given inputs (via the `perform`),
- performing the calculation of outputs from given inputs (via the `perform`),
- producing c code to perform calculation of outputs from inputs (via `c_code`,
`c_code_cleanup`, `c_support_code`, `c_headers`, `c_libraries`, `c_compile_args`)
- [optionally] building gradient-calculating graphs (via `grad`).
- [optionally] building gradient-calculating graphs (via `grad`).
...
@@ -186,7 +176,7 @@ class Op(Op_clinker):
...
@@ -186,7 +176,7 @@ class Op(Op_clinker):
def
make_node
(
self
,
*
inputs
):
def
make_node
(
self
,
*
inputs
):
"""
"""
Contract
: return an Apply instance representing the
Required
: return an Apply instance representing the
application of this Op to the provided inputs.
application of this Op to the provided inputs.
All subclasses should over-ride this function.
All subclasses should over-ride this function.
...
@@ -198,8 +188,7 @@ class Op(Op_clinker):
...
@@ -198,8 +188,7 @@ class Op(Op_clinker):
raise
utils
.
AbstractFunctionError
(
self
)
raise
utils
.
AbstractFunctionError
(
self
)
def
__call__
(
self
,
*
inputs
):
def
__call__
(
self
,
*
inputs
):
"""
"""Optional: Return some or all output[s] of `make_node`.
Return some or all output[s] of `make_node`.
It is called by code such as:
It is called by code such as:
...
@@ -232,7 +221,7 @@ class Op(Op_clinker):
...
@@ -232,7 +221,7 @@ class Op(Op_clinker):
def
perform
(
self
,
node
,
inputs
,
output_storage
):
def
perform
(
self
,
node
,
inputs
,
output_storage
):
"""
"""
Contract
: Calculate the function on the inputs and put the results in the
Required
: Calculate the function on the inputs and put the results in the
output storage. Return None.
output storage. Return None.
:Parameters:
:Parameters:
...
@@ -254,4 +243,6 @@ class Op(Op_clinker):
...
@@ -254,4 +243,6 @@ class Op(Op_clinker):
"""
"""
raise
utils
.
AbstractFunctionError
(
self
)
raise
utils
.
AbstractFunctionError
(
self
)
class
Op
(
utils
.
object2
,
PureOp
,
CLinkerOp
):
"""Convenience class to bundle `PureOp` and `CLinkerOp`"""
pass
local.epydoc
浏览文件 @
0d4f392c
...
@@ -120,13 +120,9 @@ separate-classes: no
...
@@ -120,13 +120,9 @@ separate-classes: no
# Use this URL prefix to configure the string returned for external API.
# Use this URL prefix to configure the string returned for external API.
#external-api-root: epydoc:http://epydoc.sourceforge.net/api
#external-api-root: epydoc:http://epydoc.sourceforge.net/api
external-api: wiki
external-api: wiki doc
external-api-root: wiki:http://lgcm.iro.umontreal.ca/theano/wiki/
external-api-root: wiki:http://lgcm.iro.umontreal.ca/theano/wiki/ doc:http://lgcm.iro.umontreal.ca/auto_theano/doc/
external-api-file: wiki:wiki.idx
external-api-file: wiki:wiki.idx doc:doc/doc.idx
external-api: doc
external-api-root: doc:http://lgcm.iro.umontreal.ca/doc/
external-api-file: doc:doc/doc.idx
### Graph options
### Graph options
...
...
wiki.idx
浏览文件 @
0d4f392c
DefineGraph DefineGraph
wiki.DefineGraph DefineGraph
DefineTensorResult DefineTensor#TensorResult
wiki.DefineTensorResult DefineTensor#TensorResult
Connection.cursor() NothingInvalid.html
wiki.HowtoList HowtoList
wiki.UserBasic UserBasic
wiki.UserAdvanced UserAdvanced
wiki.TerminologyGlossary TerminologyGlossary
wiki.glossary TerminologyGlossary
wiki.IndexHowto IndexHowto
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论