Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2fb62455
提交
2fb62455
authored
10月 23, 2014
作者:
Nicolas Ballas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update extending_theano tutorial
上级
3c038793
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
29 行增加
和
17 行删除
+29
-17
extending_theano.txt
doc/tutorial/extending_theano.txt
+29
-17
没有找到文件。
doc/tutorial/extending_theano.txt
浏览文件 @
2fb62455
...
...
@@ -112,10 +112,10 @@ of :class:`gof.Op`. More specifically, it is mandatory for an op to define the
:func:`perform` method defines the
actual
implementation of an op.
:func:`perform` method defines the
Python
implementation of an op.
It takes several arguments:
- ``node``: This is a reference to an Apply node which was previously
obtained via the ``Op``'s
``make_node`
` method. It is typically not
obtained via the ``Op``'s
:func:`make_node
` method. It is typically not
used in simple ops, but it contains symbolic information that
could be required for complex ops.
- ``inputs``: This is a list of references to data to operate on using
...
...
@@ -166,8 +166,13 @@ related c_methods. Note that an op can provide both Python and C implementation.
:func:`make_thunk` is useful if you want to generate code and compile
it yourself. For example, this allows you to use PyCUDA to compile GPU
code. If both :func:`make_thunk` and :func:`perform` are defined by an op,
:func:`perform` will be ignored.
code.
If :func:`make_thunk()` is defined by an op, it will be used by Theano
to obtainthe op's implementationm bith , both perform() and the methods related to the C implementation will be ignored
If both :func:`make_thunk` and :func:`perform` are defined by an op,
:func:`perform` and :meth:`Op.c_code` will be ignored.
Other methods can be optionally defined by the op.
...
...
@@ -177,29 +182,36 @@ Other methods can be optionally defined by the op.
:func:`__eq__` and :func:`__hash__` will be used by the optimization
phase to merge nodes that are doing a equivalent compuation (same
inputs, same operation). It is especially important that two ops that
compare equal a
m
d compute the same thing when presented
compare equal a
n
d compute the same thing when presented
with the same inputs.
Also note that this attribute will also generate a suitable
:func:`__str__` method for your op. You may override this default
with a custom one if you want another format for the output.
The :attr:`__props__` attribute serves to make op generate an
appropriate :func:`__eq__` and :func:`__hash__` for your op. It must
be a tuple that lists the properties that influence how the
computation is performed (Ususally these are those that you set in
:func:`__init__`). If you don't have any properties, then you should
set this attribute to the emtpy tuple `()`.
Two ops will be equal if they have the same values for all the properties
listed in :attr:`__props__`.
The :attr:`__props__` lists the properties
that influence how the computation is performed (Ususally these are those
that you set in :func:`__init__`). It must be a tuple.
If you don't have any properties, then you should set this attribute to the
emtpy tuple `()`.
:attr:`__props__` also enables the automatic generation of appropriate
:func:`__eq__` and :func:`__hash__`.
Given the method :func:`__eq__`, automatically generated from
:attr:`__props__`, two ops will be equal if they have the same values for all
the properties listed in :attr:`__props__`.
Given to the method :func:`__hash__` automatically generated from
:attr:`__props__`, two ops will be have the same hash if they have the same
values for all the properties listed in :attr:`__props__`.
:attr:`__props__` will also generate a suitable :func:`__str__` for your op.
This requires development version after September 1st, 2014 or version 0.7.
The :func:`infer_shape` method allows to infer the shape of some variable,
somewhere in the middle of the computational graph without actually
computing the outputs.
The :func:`infer_shape` method allows to infer the shape of the node
output variable, without actually computing the outputs.
Inputs are tuples of Theano variables. Output is a list of tuples of
Theano variables.
Inputs and the return value are symbolic Theano Variables.
:func:`infer_shape` takes as input ``node``, a reference to the op Apply node
and a list of Theano symbolic Varables (``i0_shape``, ``i1_shape``, ...)
which are the shape of the op input Variables.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论