Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
20e9af3b
提交
20e9af3b
authored
7月 30, 2012
作者:
Eric Larsen
提交者:
Frederic
9月 12, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Correct Theanos's tutorial: correct typos and mistakes, extend description of testing procedure
上级
bf3880d4
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
38 行增加
和
16 行删除
+38
-16
extending_theano.txt
doc/tutorial/extending_theano.txt
+36
-14
modes.txt
doc/tutorial/modes.txt
+2
-2
没有找到文件。
doc/tutorial/extending_theano.txt
浏览文件 @
20e9af3b
...
@@ -40,6 +40,8 @@ Inputs and Outputs are lists of Theano variables.
...
@@ -40,6 +40,8 @@ Inputs and Outputs are lists of Theano variables.
See the :ref:`dev_start_guide` for information about git, github, the
See the :ref:`dev_start_guide` for information about git, github, the
development workflow and how to make a quality contribution.
development workflow and how to make a quality contribution.
Op Contract
-----------
-----------
...
@@ -163,7 +165,7 @@ Op Example
...
@@ -163,7 +165,7 @@ Op Example
return eval_points
return eval_points
return self.grad(inputs, eval_points)
return self.grad(inputs, eval_points)
Try it!
:
You can try it as follows
:
.. code-block:: python
.. code-block:: python
...
@@ -176,8 +178,9 @@ Try it!:
...
@@ -176,8 +178,9 @@ Try it!:
print inp
print inp
print out
print out
How To Test it
How To Test it
--------------
Theano has some functions to simplify testing. These help test the
Theano has some functions to simplify testing. These help test the
``infer_shape``, ``grad`` and ``R_op`` methods. Put the following code
``infer_shape``, ``grad`` and ``R_op`` methods. Put the following code
...
@@ -221,9 +224,9 @@ output.
...
@@ -221,9 +224,9 @@ output.
``self._compile_and_check`` compiles a Theano function. It takes as
``self._compile_and_check`` compiles a Theano function. It takes as
parameters the lists of input and output Theano variables, as would be
parameters the lists of input and output Theano variables, as would be
provided to ``theano.function``, and a list of real values to pass to the
provided to ``theano.function``, and a list of real values to pass to the
compiled function (do
n't use shapes that are symmetric
, e.g. (3, 3),
compiled function (do
not use symmetric shapes
, e.g. (3, 3),
as they can easily
to hide errors). It also takes the op class as a parameter to
as they can easily
hide errors). It also takes the op class as a parameter
verify that no instance of it appears in the shape-optimized graph.
in order to
verify that no instance of it appears in the shape-optimized graph.
If there is an error, the function raises an exception. If you want to
If there is an error, the function raises an exception. If you want to
see it fail, you can implement an incorrect ``infer_shape``.
see it fail, you can implement an incorrect ``infer_shape``.
...
@@ -297,23 +300,42 @@ GPU.
...
@@ -297,23 +300,42 @@ GPU.
Running Your Tests
Running Your Tests
------------------
------------------
You can run the command ``nosetests`` in the Theano folder to run all of Theano's
To perform your tests, you may select either one of the three following methods:
tests, including yours if they are somewhere in the directory structure.
The following command lines have these purposes:
**theano-nose**
The method of choice to run every test located in a specific folder
or in Theano's path is to run the file ``theano-nose`` which is by default located in
the ``theano/bin`` folder. If a folder is specified on the command line, every test
it contains will be conducted. Otherwise, every test found in Theano's path will be.
* ``nosetests test_file.py``: run all the tests in the file *test_file.py*.
Help with the use and functionalities of ``theano-nose`` may be obtained by running
it with the command line parameter ``--help (-h)``.
* ``nosetests test_file.py:test_DoubleRop``: run only the tests found inside the test.
**nosetests**
class *test_DoubleRop*
* ``nosetests test_file.py:test_DoubleRop.test_double_op``: run only the test *test_double_op*
The command ``nosetests`` can also be used. Although it lacks the useful
functionalities that ``theano-nose`` provides, you can use ``nosetests`` similarly
to ``theano-nose`` to run all tests in Theano's
path or in a specific folder. Nevertheless, ``nosetests`` is particularly useful for development
purposes since it allows to request for specific tests. For instance, the following command
lines may be used for these respective purposes:
* ``nosetests test_file.py``: Run every test found in the file *test_file.py*.
* ``nosetests test_file.py:test_DoubleRop``: Run every test found inside the class *test_DoubleRop*.
* ``nosetests test_file.py:test_DoubleRop.test_double_op``: Run only the test *test_double_op*
in the class *test_DoubleRop*.
in the class *test_DoubleRop*.
More documentation on ``nosetests`` is available here:
More documentation on ``nosetests`` is available here:
`nosetests <http://readthedocs.org/docs/nose/en/latest/>`_.
`nosetests <http://readthedocs.org/docs/nose/en/latest/>`_.
Alternatively, you can add the following block of code the end of the test file and run it
**In-file**
file so as to have the test *test_DoubleRop.test_double_op* performed:
One may also add a block of code similar to the following at the end of the
file containing a specific test of interest and run the file. In this example, the test
*test_DoubleRop* in the class *test_double_op* would be performed.
.. code-block:: python
.. code-block:: python
...
...
doc/tutorial/modes.txt
浏览文件 @
20e9af3b
...
@@ -173,11 +173,11 @@ Here is a table to compare the different linkers.
...
@@ -173,11 +173,11 @@ Here is a table to compare the different linkers.
============= ========= ================= ========= ===
============= ========= ================= ========= ===
linker gc [#gc]_ Raise error by op Overhead Definition
linker gc [#gc]_ Raise error by op Overhead Definition
============= ========= ================= ========= ===
============= ========= ================= ========= ===
c|py [#cpy1]_ yes yes "+++" Try C code. If none exist for an op, use Python
c|py [#cpy1]_ yes yes "+++" Try C code. If none exist
s
for an op, use Python
c|py_nogc no yes "++" As c|py, but without gc
c|py_nogc no yes "++" As c|py, but without gc
c no yes "+" Use only C code (if none available for an op, raise an error)
c no yes "+" Use only C code (if none available for an op, raise an error)
py yes yes "+++" Use only Python code
py yes yes "+++" Use only Python code
c&py [#cpy2]_ no yes "+++++" Use
c
and Python code
c&py [#cpy2]_ no yes "+++++" Use
C
and Python code
ProfileMode no no "++++" Compute some extra profiling info
ProfileMode no no "++++" Compute some extra profiling info
DebugMode no yes VERY HIGH Make many checks on what Theano computes
DebugMode no yes VERY HIGH Make many checks on what Theano computes
============= ========= ================= ========= ===
============= ========= ================= ========= ===
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论