Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e1dfdef0
提交
e1dfdef0
authored
2月 17, 2009
作者:
Joseph Turian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated extending.txt
上级
2957af88
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
11 行增加
和
8 行删除
+11
-8
extending.txt
doc/doc/extending.txt
+11
-8
没有找到文件。
doc/doc/extending.txt
浏览文件 @
e1dfdef0
...
@@ -9,28 +9,31 @@ Lets start by looking at what happens in a simple theano program.
...
@@ -9,28 +9,31 @@ Lets start by looking at what happens in a simple theano program.
.. code-block:: python
.. code-block:: python
#!python
x = tensor.matrix('x')
x = tensor.matrix('x')
y = tensor.matrix('y')
y = tensor.matrix('y')
z = x + y
z = x + y
f = theano.function(input=[x,y], output=z, mode='FAST_RUN')
f = theano.function(input=[x,y], output=z, mode='FAST_RUN')
print f(numpy.ones(2,3), numpy.ones(2,3))
print f(numpy.ones(2,3), numpy.ones(2,3))
The first three lines build a graph_ whose nodes correspond to variables (``x,y,z``) and expressions (just the '+' here).
The first three lines build a :term:`graph` whose nodes correspond to variables (``x,y,z``) and expressions (just the '+' here).
The variables in such a graph are Result_ instances of some Type_, and the expressions are Apply_ instances of some Op_.
The variables in such a graph are :term:`Result` instances of some
:term:`Type`, and the expressions are :term:`Apply` instances of some
:term:`Op`.
The line ``f = theano.function([x,y], [z], mode='FAST_RUN')`` compiles_
The line ``f = theano.function([x,y], [z], mode='FAST_RUN')`` :term:`compiles
the graph we built and returns a function_ whose ``__call__`` method
<Compilation>`.
the graph we built and returns a :term:`function` whose ``__call__`` method
takes as arguments the values to use for ``x`` and ``y``.
takes as arguments the values to use for ``x`` and ``y``.
The
mode_ controls which transformations_
are applied to the graph as we compile it.
The
:term:`mode` controls which :term:`transformations <Graph Transformation>`
are applied to the graph as we compile it.
The line ``print f(numpy.ones(2,3), numpy.ones(2,3))`` creates two
The line ``print f(numpy.ones(2,3), numpy.ones(2,3))`` creates two
matrices, and then uses f's ``__call__`` method to run the compiled
matrices, and then uses f's ``__call__`` method to run the compiled
function on those inputs.
function on those inputs.
The compiled function is executed by a
linker_, which was also specified by the mode_
argument to ``function``.
The compiled function is executed by a
:term:`linker`, which was also specified by the :term:`mode`
argument to ``function``.
The instance f's ``__call__`` method returns a value for ``z`` (given ``x,y``) which we print.
The instance f's ``__call__`` method returns a value for ``z`` (given ``x,y``) which we print.
Theano was designed to be extensible to new types_ of Result, new Ops_ to use in symbolic computations,
Theano was designed to be extensible to new :term:`types <Type>` of Result,
new :term:`Ops <Op>` to use in symbolic computations,
and new modes of compilation and execution. When you're comfortable with the material above, move on to:
and new modes of compilation and execution. When you're comfortable with the material above, move on to:
* HowtoCreateType create a new data type,
* HowtoCreateType create a new data type,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论