提交 4b8b6eee authored 作者: Iban Harlouchet's avatar Iban Harlouchet 提交者: Arnaud Bergeron

testcode for doc/extending/fibby.txt

上级 c25e8465
...@@ -29,7 +29,9 @@ you should check the strides and alignment. ...@@ -29,7 +29,9 @@ you should check the strides and alignment.
.. If you modify this code, also change : .. If you modify this code, also change :
.. theano/tests/test_tutorial.py:T_fibby.test_fibby_1 .. theano/tests/test_tutorial.py:T_fibby.test_fibby_1
.. code-block:: python .. testcode::
import theano
class Fibby(theano.Op): class Fibby(theano.Op):
""" """
...@@ -143,7 +145,7 @@ the correct size for the output. This is essentially simulating the line ...@@ -143,7 +145,7 @@ the correct size for the output. This is essentially simulating the line
``y = x.copy()``. ``y = x.copy()``.
.. code-block:: python .. testcode::
Py_XDECREF(%(y)s); Py_XDECREF(%(y)s);
%(y)s = (PyArrayObject*)PyArray_FromArray( %(y)s = (PyArrayObject*)PyArray_FromArray(
...@@ -206,7 +208,7 @@ TODO: talk about OPTIMIZATION STAGES ...@@ -206,7 +208,7 @@ TODO: talk about OPTIMIZATION STAGES
.. If you modify this code, also change : .. If you modify this code, also change :
.. theano/tests/test_tutorial.py:T_fibby.test_fibby_1 .. theano/tests/test_tutorial.py:T_fibby.test_fibby_1
.. code-block:: python .. testcode::
from theano.tensor.opt import get_scalar_constant_value, NotScalarConstantError from theano.tensor.opt import get_scalar_constant_value, NotScalarConstantError
...@@ -237,7 +239,12 @@ Test the optimization ...@@ -237,7 +239,12 @@ Test the optimization
Here is some code to test that the optimization is applied only when needed. Here is some code to test that the optimization is applied only when needed.
.. code-block:: python .. testcode::
import numpy
import theano.tensor as T
from theano import function
from theano import tensor
# Test it does not apply when not needed # Test it does not apply when not needed
x = T.dvector() x = T.dvector()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论