提交 88d73dd6 authored 作者: Iban Harlouchet's avatar Iban Harlouchet 提交者: Arnaud Bergeron

testcode for doc/tutorial/extending_theano_c.txt

上级 6dedf856
......@@ -129,7 +129,7 @@ that the data is not only contiguous in memory but also that it is organized
such that the index of the latest dimension changes the fastest. If the
following array
.. code-block:: python
.. testcode::
x = [[1, 2, 3],
[4, 5, 6]]
......@@ -337,7 +337,7 @@ commonly used.
of C code that you should include in your C code (after ensuring that a
Python exception is set) if it needs to raise an exception. Ex:
.. code-block:: python
.. code-block:: c
c_code = """
PyErr_Format(PyExc_ValueError, "X does not have the right value");
......@@ -354,7 +354,7 @@ commonly used.
``%`` characters in the format characters need to be escaped since the C
code itself is defined in a string which undergoes string formatting.
.. code-block:: python
.. code-block:: c
c_code = """
PyErr_Format(PyExc_ValueError,
......@@ -440,7 +440,7 @@ need to validate that the output storage has been allocated and has the same
shape as our vector input. If it is not the case, we allocate a new output
storage with the right shape and number of dimensions.
.. code-block:: python
.. testcode:: examples
import numpy
import theano
......@@ -565,7 +565,7 @@ the inputs (because of the upcast in the method ``make_node()``), the typenum
of the output has to be obtained in the Python code and then included in the
C code.
.. code-block:: python
.. testcode:: examples
class VectorTimesVector(gof.Op):
__props__ = ()
......@@ -705,7 +705,7 @@ implemented using the ``COp`` class.
The new op is defined inside a Python file with the following code :
.. code-block:: python
.. testcode::
import theano
from theano import gof
......@@ -895,7 +895,7 @@ defined to False. In these descrptions 'i' refers to the position
corresponds to ``npy_float32`` and can directly be used to declare a
new variable of the same dtype as the data in the array :
.. code-block:: c
.. testcode::
DTYPE_INPUT_0 myVar = someValue;
......@@ -914,7 +914,7 @@ In addition to these macros, the ``init_code_struct``, ``code``, and
* ``FAIL`` : Code to insert at error points. A python exception
should be set prior to this code. An invocation look like this:
.. code-block:: c
.. testcode::
if (error) {
// Set python exception
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论