提交 57cc392b authored 作者: Hengjean's avatar Hengjean

Wrote doc for check_input.

上级 799e97dd
......@@ -50,7 +50,7 @@ the most important ones:
.. 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
will be available to operations defined in C. You may also write
......@@ -61,7 +61,7 @@ the most important ones:
This must return C code which initializes the variables declared in
``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
and initializes the variables declared in ``c_declare`` to match the
......@@ -129,6 +129,11 @@ associated to the Variable is ``py_<name>``.
``sub``, on the other hand, is a dictionary containing bits of C code
suitable for use in certain situations. For instance, ``sub['fail']``
contains code that should be inserted wherever an error is identified.
``c_declare`` and ``c_extract`` also takes a third ``check_input``
optional argument. If you want your type to validate its inputs, it must
do it only when ``check_input`` is True.
The example code below should help you understand how everything plays
out:
......
......@@ -92,6 +92,8 @@ Op Contract
def flops(self, inputs, outputs):
pass
check_input = True
.. ../extending/op.txt
There are two mandatory methods that one needs to implement.
......@@ -133,6 +135,10 @@ string representation of your op.
The :func:`R_op` method is needed if you want ``theano.tensor.Rop`` to
work with your op.
The optionnal 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 and reduce the
number of generated c_file.
Op Example
==========
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论