提交 1c2dfb89 authored 作者: Iban Harlouchet's avatar Iban Harlouchet 提交者: Arnaud Bergeron

testcode for doc/library/compile/nanguardmode.txt

上级 0f79103e
...@@ -21,7 +21,12 @@ of abnormal values: NaNs, Infs, and abnormally big values. ...@@ -21,7 +21,12 @@ of abnormal values: NaNs, Infs, and abnormally big values.
NanGuardMode can be used as follows: NanGuardMode can be used as follows:
.. code-block:: python .. testcode::
import numpy
import theano
import theano.tensor as T
from theano.compile.nanguardmode import NanGuardMode
x = T.matrix() x = T.matrix()
w = theano.shared(numpy.random.randn(5, 7).astype(theano.config.floatX)) w = theano.shared(numpy.random.randn(5, 7).astype(theano.config.floatX))
...@@ -36,7 +41,7 @@ input and output variable of each node. When abnormal values are ...@@ -36,7 +41,7 @@ input and output variable of each node. When abnormal values are
detected, it raises an error to indicate which node yields the NaNs. For detected, it raises an error to indicate which node yields the NaNs. For
example, if we pass the following values to ``fun``: example, if we pass the following values to ``fun``:
.. code-block:: python .. testcode::
infa = numpy.tile( infa = numpy.tile(
(numpy.asarray(100.) ** 1000000).astype(theano.config.floatX), (3, 5)) (numpy.asarray(100.) ** 1000000).astype(theano.config.floatX), (3, 5))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论