Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
40a39f61
提交
40a39f61
authored
10月 21, 2011
作者:
David Warde-Farley
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Spelling/grammar fixes.
上级
9501ca28
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
45 行增加
和
42 行删除
+45
-42
extending_theano.txt
doc/cifarSC2011/extending_theano.txt
+27
-26
op.txt
doc/extending/op.txt
+16
-14
check_blas.py
theano/misc/check_blas.py
+2
-2
没有找到文件。
doc/cifarSC2011/extending_theano.txt
浏览文件 @
40a39f61
...
@@ -10,8 +10,8 @@ Theano graphs
...
@@ -10,8 +10,8 @@ Theano graphs
- Theano works with symbolic graphs
- Theano works with symbolic graphs
- Those graphs are bi-partite graphs (graph with 2 types of nodes)
- Those graphs are bi-partite graphs (graph with 2 types of nodes)
- Th
ose 2 nodes typ
es are Apply and Variable nodes
- Th
e 2 types of nod
es are Apply and Variable nodes
-
Apply node have a link to the Op that it execute
-
Each Apply node has a link to the Op that it executes
Inputs and Outputs are lists of Theano variables
Inputs and Outputs are lists of Theano variables
...
@@ -50,35 +50,36 @@ Op contract
...
@@ -50,35 +50,36 @@ Op contract
.. ../extending/op.txt
.. ../extending/op.txt
There
is 2 mandatory function
. The first is :func:`make_node`. The
There
are 2 mandatory methods
. The first is :func:`make_node`. The
second is the one that
do/tell the computation to do
at run
second is the one that
expresses what computation should be done
at run
time. Currently you have 4 pos
ibility
: implement the :func:`perform`
time. Currently you have 4 pos
sibilities
: implement the :func:`perform`
and/or :func:`c_code <Op.c_code>` (and other related :ref:`
c
functions
and/or :func:`c_code <Op.c_code>` (and other related :ref:`
C
functions
<cop>`), or the :func:`make_thunk`
function. The ``perform`` allow
you
<cop>`), or the :func:`make_thunk`
method. The ``perform`` method allows
you
to easily wrap an existing
p
ython function in Theano. The ``c_code``
to easily wrap an existing
P
ython function in Theano. The ``c_code``
and related
function allow you to have your op generate c
code and
and related
methods allow you to have your op generate C
code and
have Theano compile and link to it. The ``make_thunk``
function
will
have Theano compile and link to it. The ``make_thunk``
method
will
be called during compilation and should generate a ``thunk``: a
be called during compilation and should generate a ``thunk``: a
function that when called will do the want
ed computation. This is
method that when called will do the desir
ed computation. This is
useful
l
if you want to generate code and compile it yourself. For
useful if you want to generate code and compile it yourself. For
example, this allow you to use PyCUDA to compile
gpu
code.
example, this allow you to use PyCUDA to compile
GPU
code.
There
is 2 mandatory/highly suggested function. They are needed to
for a basic
There
are 2 mandatory/highly recommended methods. They are needed
for a basic
optimization that merge
duplicate computation in a Theano function. So
optimization that merge
s duplicate computations in a Theano function. Thus,
if you don't want Theano to
do you computation multiple time
for no
if you don't want Theano to
perform your computations multiple times
for no
good reason, implement the
m! Those function
are :func:`__eq__` and
good reason, implement the
se! Those methods
are :func:`__eq__` and
:func:`__hash__`.
:func:`__hash__`.
The :func:`infer_shape` method allow some very interesting
The :func:`infer_shape` method allow
s for
some very interesting
optimization
like don't performing the computation of your op just
to
optimization
s, such as not performing your op's computations simply
to
tak
e the shape your Op's output.
determin
e the shape your Op's output.
The :func:`grad` method is needed
you want want
differentiation to
The :func:`grad` method is needed
if you want symbolic
differentiation to
work with your
o
p.
work with your
O
p.
The :func:`__str__` is usefull to have a better printing of you op.
The :func:`__str__` is useful in order to provide a more meaningful string
representation of your Op.
The :func:`R_op` is needed if you want
theano.tensor.Rop
to work with your op.
The :func:`R_op` is needed if you want
`theano.tensor.Rop`
to work with your op.
Op example
Op example
----------
----------
...
@@ -121,7 +122,7 @@ Exercises 8
...
@@ -121,7 +122,7 @@ Exercises 8
- Modify and execute to compute: x * y
- Modify and execute to compute: x * y
- Modify and execute the example to return 2 outputs: x + y and x - y
- Modify and execute the example to return 2 outputs: x + y and x - y
- Our current elem
wise fusion generate computation with only 1 outputs
- Our current elem
ent-wise fusion generates computation with only 1 output.
doc/extending/op.txt
浏览文件 @
40a39f61
...
@@ -141,17 +141,17 @@ following methods:
...
@@ -141,17 +141,17 @@ following methods:
Optional.
Optional.
This
function
is needed for shape optimization. ``shapes`` is a
This
method
is needed for shape optimization. ``shapes`` is a
list with one tuple for each input t
he Apply node linked to this op
list with one tuple for each input t
o the Apply node linked to this Op.
have. Each tuple contain 1 element for each dimensions
of the
Each tuple contains 1 element for each dimension
of the
corresponding input
s. The value is the the corresponding
corresponding input
. The value corresponds to the input's size
dimensions shape of the corresponding inputs
.
along the given dimension
.
This sound
complicated, but this is just the corresponding input
s
This sound
s complicated, but this is just the corresponding input'
s
shape in symbolic variable.
shape in
a
symbolic variable.
The function should return a list with one tuple for each output.
The function should return a list with one tuple for each output.
Each tuple should contain the corresponding output's shape.
Each tuple should contain the corresponding output's
computed
shape.
.. function:: make_thunk(node, storage_map, compute_map, no_recycling)
.. function:: make_thunk(node, storage_map, compute_map, no_recycling)
...
@@ -186,14 +186,16 @@ following methods:
...
@@ -186,14 +186,16 @@ following methods:
*Default:* python default: module_path_to_your_class.CLASSNAME
*Default:* python default: module_path_to_your_class.CLASSNAME
This allow you to have a better printing of Op. If an Op have parameter
This allows you to specify a more informative string representation of your
it is highly recommented that it make the ``__str__`` function
Op. If an Op has parameters, it is highly recommended to have the
print the name of the op and the Op's parameters values.
``__str__`` method include the name of the op and the Op's parameters'
values.
At a bare minimum, a new Op must define ``make_node`` and ``perform``, which have no defaults.
At a bare minimum, a new Op must define ``make_node`` and ``perform``, which
have no defaults.
Also you can
provide a :ref:`C implementation <cop>` of
You can also
provide a :ref:`C implementation <cop>` of
``perform()``. For
other details
refer to the documentation for
``perform()``. For
more details,
refer to the documentation for
:ref:`op`.
:ref:`op`.
...
...
theano/misc/check_blas.py
浏览文件 @
40a39f61
...
@@ -92,9 +92,9 @@ if __name__ == "__main__":
...
@@ -92,9 +92,9 @@ if __name__ == "__main__":
if
verbose
:
if
verbose
:
print
"""
print
"""
Some result
that you can compare again. They where 10 executions of gemm in float64 with matrix
of shape 2000x2000.
Some result
s that you can compare against. They were 10 executions of gemm in float64 with matrices
of shape 2000x2000.
C
pu
tested: Xeon E5345(2.33Ghz, 8M L2 cache, 1333Mhz FSB), Xeon E5430(2.66Ghz, 12M L2 cache, 1333Mhz FSB),
C
PU
tested: Xeon E5345(2.33Ghz, 8M L2 cache, 1333Mhz FSB), Xeon E5430(2.66Ghz, 12M L2 cache, 1333Mhz FSB),
Xeon E5450(3Ghz, 12M L2 cache, 1333Mhz FSB), Xeon X5560(2.8Ghz, 12M L2 cache, 6.4GT/s QPI, hyper-threads enabled?)
Xeon E5450(3Ghz, 12M L2 cache, 1333Mhz FSB), Xeon X5560(2.8Ghz, 12M L2 cache, 6.4GT/s QPI, hyper-threads enabled?)
Core 2 E8500, Core i7 930(2.8Ghz, hyper-threads enabled), Core i7 950(3.07GHz, hyper-threads enabled)
Core 2 E8500, Core i7 930(2.8Ghz, hyper-threads enabled), Core i7 950(3.07GHz, hyper-threads enabled)
Xeon X5550(2.67GHz, 8M l2 cache?, hyper-threads enabled)
Xeon X5550(2.67GHz, 8M l2 cache?, hyper-threads enabled)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论