提交 2815db5b authored 作者: James Bergstra's avatar James Bergstra

small changes to debugmode docs

上级 12d2c60c
......@@ -8,7 +8,8 @@ Debugging Theano: FAQ and Troubleshooting
There are many kinds of bugs that might come up in a computer program.
This page is structured as an FAQ. It should provide recipes to tackle common
problems, and introduce some of the tools that we use to find problems in our
Theano code, and even (it happens) in Theano's internals.
Theano code, and even (it happens) in Theano's internals, such as
:ref:`debugmode`.
......@@ -18,7 +19,7 @@ How do I print an intermediate value in a Function/Method?
Theano provides a 'Print' Op to do this.
.. code-block::
.. code-block:: python
x = theano.tensor.dvector('x')
......
......@@ -382,14 +382,18 @@ class TestEquilibrium(object):
e = op3(op4(x, y))
g = Env([x, y, z], [e])
print 'before', g
oldstderr = sys.stderr
sys.stderr = sys.stdout # display pesky warnings along with stdout
opt = EquilibriumOptimizer(
[PatternSub((op1, 'x', 'y'), (op2, 'x', 'y')),
PatternSub((op4, 'x', 'y'), (op1, 'x', 'y')),
PatternSub((op3, (op2, 'x', 'y')), (op4, 'x', 'y'))
],
max_use_ratio = 1. / len(g.nodes)) # each opt can only be applied once
opt.optimize(g)
try:
opt = EquilibriumOptimizer(
[PatternSub((op1, 'x', 'y'), (op2, 'x', 'y')),
PatternSub((op4, 'x', 'y'), (op1, 'x', 'y')),
PatternSub((op3, (op2, 'x', 'y')), (op4, 'x', 'y'))
],
max_use_ratio = 1. / len(g.nodes)) # each opt can only be applied once
opt.optimize(g)
finally:
sys.stderr = oldstderr
print 'after', g
assert str(g) == '[Op4(x, y)]'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论