ccw 5079

上级 3343d912
...@@ -220,6 +220,29 @@ The ``compute_test_value`` mechanism works as follows: ...@@ -220,6 +220,29 @@ The ``compute_test_value`` mechanism works as follows:
This feature is currently incompatible with ``Scan`` and also with ops This feature is currently incompatible with ``Scan`` and also with ops
which do not implement a ``perform`` method. which do not implement a ``perform`` method.
It is also possible to override variables ``__repr__`` method to have them return tag.test_value.
.. testcode:: printtestvalue
x = T.scalar('x')
# Assigning test value
x.tag.test_value = 42
# Enable test value printing
theano.config.print_test_value = True
print(x.__repr__())
# Disable test value printing
theano.config.print_test_value = False
print(x.__repr__())
Running the code above returns the following output:
.. testcode:: printtestvalue
x
array(42.0)
x
"How do I Print an Intermediate Value in a Function?" "How do I Print an Intermediate Value in a Function?"
----------------------------------------------------- -----------------------------------------------------
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论