Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7f44b538
提交
7f44b538
authored
6月 18, 2014
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1922 from Hengjean/CheckInputDoc
Check input doc
上级
53e556fc
c9262306
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
13 行增加
和
2 行删除
+13
-2
ctype.txt
doc/extending/ctype.txt
+7
-2
extending_theano.txt
doc/tutorial/extending_theano.txt
+6
-0
没有找到文件。
doc/extending/ctype.txt
浏览文件 @
7f44b538
...
@@ -50,7 +50,7 @@ the most important ones:
...
@@ -50,7 +50,7 @@ the most important ones:
.. class:: CLinkerType
.. class:: CLinkerType
.. method:: c_declare(name, sub)
.. method:: c_declare(name, sub
, check_input=True
)
This must return C code which declares variables. These variables
This must return C code which declares variables. These variables
will be available to operations defined in C. You may also write
will be available to operations defined in C. You may also write
...
@@ -61,7 +61,7 @@ the most important ones:
...
@@ -61,7 +61,7 @@ the most important ones:
This must return C code which initializes the variables declared in
This must return C code which initializes the variables declared in
``c_declare``. Either this or ``c_extract`` will be called.
``c_declare``. Either this or ``c_extract`` will be called.
.. method:: c_extract(name, sub)
.. method:: c_extract(name, sub
, check_input=True
)
This must return C code which takes a reference to a Python object
This must return C code which takes a reference to a Python object
and initializes the variables declared in ``c_declare`` to match the
and initializes the variables declared in ``c_declare`` to match the
...
@@ -129,6 +129,11 @@ associated to the Variable is ``py_<name>``.
...
@@ -129,6 +129,11 @@ associated to the Variable is ``py_<name>``.
``sub``, on the other hand, is a dictionary containing bits of C code
``sub``, on the other hand, is a dictionary containing bits of C code
suitable for use in certain situations. For instance, ``sub['fail']``
suitable for use in certain situations. For instance, ``sub['fail']``
contains code that should be inserted wherever an error is identified.
contains code that should be inserted wherever an error is identified.
``c_declare`` and ``c_extract`` also accept a third ``check_input``
optional argument. If you want your type to validate its inputs, it must
only do it when ``check_input`` is True.
The example code below should help you understand how everything plays
The example code below should help you understand how everything plays
out:
out:
...
...
doc/tutorial/extending_theano.txt
浏览文件 @
7f44b538
...
@@ -92,6 +92,8 @@ Op Contract
...
@@ -92,6 +92,8 @@ Op Contract
def flops(self, inputs, outputs):
def flops(self, inputs, outputs):
pass
pass
check_input = True
.. ../extending/op.txt
.. ../extending/op.txt
There are two mandatory methods that one needs to implement.
There are two mandatory methods that one needs to implement.
...
@@ -133,6 +135,10 @@ string representation of your op.
...
@@ -133,6 +135,10 @@ string representation of your op.
The :func:`R_op` method is needed if you want ``theano.tensor.Rop`` to
The :func:`R_op` method is needed if you want ``theano.tensor.Rop`` to
work with your op.
work with your op.
The optional boolean :func:'check_input' attribute is used to specify if you want the types used in
your op to check their inputs in their c_code. It can be used to speed up compilation, reduce overhead
(particularly for scalars) and reduce the number of generated C files.
Op Example
Op Example
==========
==========
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论