Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ecdbcd92
提交
ecdbcd92
authored
5月 15, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix docstring following code review.
上级
442cf844
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
11 行删除
+12
-11
extending_theano.txt
doc/tutorial/extending_theano.txt
+11
-10
unittest_tools.py
theano/tests/unittest_tools.py
+1
-1
没有找到文件。
doc/tutorial/extending_theano.txt
浏览文件 @
ecdbcd92
...
...
@@ -167,7 +167,7 @@ Basic tests
Basic tests are done by you just by using the Op and checking it
return the right answer. If you detect an error, you must raise an
exception. You can use the `assert` keywor
k
to raise automatically an
exception. You can use the `assert` keywor
d
to raise automatically an
AssertionError.
.. code-block:: python
...
...
@@ -191,17 +191,18 @@ AssertionError.
Testing the infer_shape
=======================
When a class inherit from the InferShapeTester class, it get the
`self._compile_and_check` method that test the Op infer_shape
method. It checks if the optimized graph obtained give the correct
values. It also tests that the Op get removed from the
graph. `self._compile_and_check with` compile theano function. So it
take as parameter the list of inputs and outputs that verify. Then
When a class inherits from the InferShapeTester class, it gets the
`self._compile_and_check` method that tests the Op infer_shape
method. It checks if the optimized graph obtained gives the correct
values. It also tests that the Op gets removed from the
graph. `self._compile_and_check` compiles a Theano function. So it
takes as parameter the list of inputs and outputs Theano variable
that is passed to `theano.function`. Then
with a list of real values to pass the the compiled function (don't
use sym
etic shape!). It also take the class op the
op to verify that
use sym
metric shape!). It also takes the class
op to verify that
it get removed from the graph.
If there is an error, the function raises an ex
ec
tion. If you want to
If there is an error, the function raises an ex
cep
tion. If you want to
see it fail, you can implement a wrong infer_shape.
.. code-block:: python
...
...
@@ -225,7 +226,7 @@ verifies the gradient of an Op or Theano graph. It compares the
analytic (symbolically computed) gradient and the numeric
gradient (computed through the Finite Difference Method).
If there is an error, the function raises an ex
ec
tion. If you want to
If there is an error, the function raises an ex
cep
tion. If you want to
see it fail, you can implement a wrong gradient (for instance removing
the multiplication by 2).
...
...
theano/tests/unittest_tools.py
浏览文件 @
ecdbcd92
...
...
@@ -172,7 +172,7 @@ class InferShapeTester(unittest.TestCase):
def
_compile_and_check
(
self
,
inputs
,
outputs
,
numeric_inputs
,
cls
,
excluding
=
None
):
"""This test the infer_shape method only"""
"""This test
s
the infer_shape method only"""
mode
=
self
.
mode
if
excluding
:
mode
=
mode
.
excluding
(
*
excluding
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论