Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6ed851b6
提交
6ed851b6
authored
3月 18, 2009
作者:
Joseph Turian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated graph structures slightly
上级
fba79533
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
39 行增加
和
19 行删除
+39
-19
graphstructures.txt
doc/advanced_tutorial/graphstructures.txt
+19
-19
index.txt
doc/advanced_tutorial/index.txt
+1
-0
theano_vs_python.txt
doc/advanced_tutorial/theano_vs_python.txt
+19
-0
没有找到文件。
doc/advanced_tutorial/graphstructures.txt
浏览文件 @
6ed851b6
...
@@ -5,16 +5,13 @@
...
@@ -5,16 +5,13 @@
Graph Structures
Graph Structures
================
================
Theano represents mathematical computations as graphs. These graphs
Theano represents symbolic mathematical computations as graphs. These
are formed of interconnected :ref:`apply` and :ref:`result` nodes,
graphs are composed of interconnected :ref:`apply` and :ref:`result`
which are standard types of objects. They are respectively associated
nodes. They are associated to *function application* and *data*,
to *function application* and *data*. Two additional structures are
respectively. Operations are represented :ref:`op` instances and data
used by Theano in order to represent the operations carried in the
types are represented by :ref:`type` instances. Here is a piece of code
computations and the data types that are processed. Operations are
and a diagram showing the structure built by that piece of code. This
represented :ref:`op` instances and data types are represented by
should help you understand how these pieces fit together:
:ref:`type` instances. Here is a piece of code and a diagram showing
the structure built by that piece of code. This should help you
understand how all these things play together:
-----------------------
-----------------------
...
@@ -38,7 +35,7 @@ box is an :ref:`apply` node. Red boxes are :ref:`result` nodes. Green
...
@@ -38,7 +35,7 @@ box is an :ref:`apply` node. Red boxes are :ref:`result` nodes. Green
circles are :ref:`Ops <op>`. Purple boxes are :ref:`Types <type>`.
circles are :ref:`Ops <op>`. Purple boxes are :ref:`Types <type>`.
When we create :ref:`Results <result>` and then :ref:`apply`
When we create :ref:`Results <result>` and then :ref:`apply`
:ref:`
operation
s <op>` to them to make more Results, we build a
:ref:`
Op
s <op>` to them to make more Results, we build a
bi-partite, directed, acyclic graph. Results point to the Apply nodes
bi-partite, directed, acyclic graph. Results point to the Apply nodes
representing the function application producing them via their
representing the function application producing them via their
``owner`` field. These Apply nodes point in turn to their input and
``owner`` field. These Apply nodes point in turn to their input and
...
@@ -49,14 +46,17 @@ they are not the result of another computation. If they were the
...
@@ -49,14 +46,17 @@ they are not the result of another computation. If they were the
result of another computation, they would point to another blue box
result of another computation, they would point to another blue box
like ``z`` does, and so on.
like ``z`` does, and so on.
Note that the ``Apply`` instance's outputs points to
``z``. ``z.owner`` points to the ``Apply`` instance.
An explicit example
An explicit example
===================
===================
In this example we will see in turn a short example
where the graph
In this example we will see in turn a short example
in which the
construction is hidden behind the standard interface's syntactic
graph
construction is hidden behind the standard interface's syntactic
shortcuts
and then the same example but rolled out so that the graph
shortcuts
. We will then see the same example but rolled out so that the
construction is made explicit.
graph
construction is made explicit.
**Short example**
**Short example**
...
@@ -85,7 +85,7 @@ This is what you would type to build the graph explicitly:
...
@@ -85,7 +85,7 @@ This is what you would type to build the graph explicitly:
from theano.tensor import *
from theano.tensor import *
#
We i
nstantiate a type that represents a matrix of doubles
#
I
nstantiate a type that represents a matrix of doubles
float64_matrix = NDArrayType(dtype = 'float64', # double
float64_matrix = NDArrayType(dtype = 'float64', # double
broadcastable = (False, False)) # matrix
broadcastable = (False, False)) # matrix
...
@@ -98,7 +98,7 @@ This is what you would type to build the graph explicitly:
...
@@ -98,7 +98,7 @@ This is what you would type to build the graph explicitly:
mul_result = Result(type = float64_matrix)
mul_result = Result(type = float64_matrix)
assert mul_result.owner is None
assert mul_result.owner is None
#
We i
nstantiate a symbolic multiplication
#
I
nstantiate a symbolic multiplication
node_mul = Apply(op = mul,
node_mul = Apply(op = mul,
inputs = [y, z],
inputs = [y, z],
outputs = [mul_result])
outputs = [mul_result])
...
@@ -108,7 +108,7 @@ This is what you would type to build the graph explicitly:
...
@@ -108,7 +108,7 @@ This is what you would type to build the graph explicitly:
add_result = Result(type = float64_matrix)
add_result = Result(type = float64_matrix)
assert add_result.owner is None
assert add_result.owner is None
#
We i
nstantiate a symbolic addition
#
I
nstantiate a symbolic addition
node_add = Apply(op = add,
node_add = Apply(op = add,
inputs = [x, mul_result],
inputs = [x, mul_result],
outputs = [add_result])
outputs = [add_result])
...
@@ -218,7 +218,7 @@ Result
...
@@ -218,7 +218,7 @@ Result
A :ref:`result` is the main data structure you work with when using
A :ref:`result` is the main data structure you work with when using
Theano. The symbolic inputs that you operate on are Results and what
Theano. The symbolic inputs that you operate on are Results and what
you get from applying various
operation
s to these inputs are also
you get from applying various
Op
s to these inputs are also
Results. For example, when I type
Results. For example, when I type
>>> x = theano.tensor.ivector()
>>> x = theano.tensor.ivector()
...
...
doc/advanced_tutorial/index.txt
浏览文件 @
6ed851b6
...
@@ -26,6 +26,7 @@ concepts at work here.
...
@@ -26,6 +26,7 @@ concepts at work here.
.. toctree::
.. toctree::
theano_vs_python
graphstructures
graphstructures
ex1/type
ex1/type
ex1/op
ex1/op
...
...
doc/advanced_tutorial/theano_vs_python.txt
0 → 100644
浏览文件 @
6ed851b6
.. _theano_vs_python:
======================
Theano vs. Python
======================
We describe some of the patterns in Theano, and present their closest
analogue in Python:
=============== ===========================================================
Theano Python
=============== ===========================================================
Apply function application / function call
Result function data
Op operations carried out in computation / function definition
Type data types
Module ??? class?
=============== ===========================================================
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论