提交 b2ee1fde authored 作者: James Bergstra's avatar James Bergstra

docs

上级 5d29d767
...@@ -14,28 +14,31 @@ Guide ...@@ -14,28 +14,31 @@ Guide
===== =====
The DebugMode evaluation mode (available via ``mode='DEBUG_MODE'``, The DebugMode evaluation mode includes a number of self-checks and assertions
see :ref:`this <function_mode>`) includes a number of self-checks and assertions that that can help to diagnose several kinds of programmer errors that can lead to
can help to diagnose several kinds of programmer errors that can lead incorrect output.
to incorrect output.
It is much slower to evaluate a function or method in DEBUG_MODE than It is much slower to evaluate a function or method with DebugMode than
it would be in FAST_RUN or even FAST_COMPILE. We recommended you use it would be in ``'FAST_RUN'`` or even ``'FAST_COMPILE'``. We recommended you use
DebugMode during development, but not when you launch 1000 processes on DebugMode during development, but not when you launch 1000 processes on
a cluster. a cluster.
DebugMode is used as follows: DebugMode can be used as follows:
.. code-block:: python .. code-block:: python
x = theano.dvector('x') x = tensor.dvector('x')
f = theano.function(x, 10*x, mode='DEBUG_MODE') f = theano.function([x], 10*x, mode='DEBUG_MODE')
f(5) f(5)
f(0) f(0)
f(7) f(7)
It can also be used by setting an environment variable ``THEANO_DEFAULT_MODE=DEBUG_MODE``.
It can also be used by passing a DebugMode instance as the mode, as in
>>> f = theano.function([x], 10*x, mode=DebugMode(check_c_code=False))
If any problem is detected, DebugMode will raise an exception according to If any problem is detected, DebugMode will raise an exception according to
what went wrong, either at call time (``f(5)``) or compile time ( what went wrong, either at call time (``f(5)``) or compile time (
...@@ -79,11 +82,7 @@ Reference ...@@ -79,11 +82,7 @@ Reference
If there are internal errors, this mode will raise an `DebugModeError` exception. If there are internal errors, this mode will raise an `DebugModeError` exception.
:remark: The work of debugging is implemented by the `_Maker`, `_Linker`, and .. attribute:: stability_patience = config.THEANO_DEBUGMODE_PATIENCE
`_VariableEquivalenceTracker` classes.
.. attibute:: stability_patience = config.THEANO_DEBUGMODE_PATIENCE
When checking for the stability of optimization, recompile the graph this many times. When checking for the stability of optimization, recompile the graph this many times.
Default 10. Default 10.
...@@ -136,7 +135,7 @@ is quite strict, and can raise several different Exception types. ...@@ -136,7 +135,7 @@ is quite strict, and can raise several different Exception types.
There following are DebugMode exceptions you might encounter: There following are DebugMode exceptions you might encounter:
..class:: DebugModeError .. class:: DebugModeError(Exception)
This is a generic error. All the other exceptions inherit from this one. This is a generic error. All the other exceptions inherit from this one.
This error is typically not raised directly. This error is typically not raised directly.
...@@ -145,7 +144,7 @@ There following are DebugMode exceptions you might encounter: ...@@ -145,7 +144,7 @@ There following are DebugMode exceptions you might encounter:
.. class:: BadCLinkerOutput .. class:: BadCLinkerOutput(DebugModeError)
This exception means that python (``perform``) and c (``c_code``) for an Op This exception means that python (``perform``) and c (``c_code``) for an Op
didn't compute the same thing like they were supposed to. didn't compute the same thing like they were supposed to.
...@@ -153,7 +152,7 @@ There following are DebugMode exceptions you might encounter: ...@@ -153,7 +152,7 @@ There following are DebugMode exceptions you might encounter:
.. class:: BadOptimization .. class:: BadOptimization(DebugModeError)
This exception indicates that an Optimization replaced one variable (say V1) This exception indicates that an Optimization replaced one variable (say V1)
with another one (say V2) but at runtime, the values for V1 and V2 were with another one (say V2) but at runtime, the values for V1 and V2 were
...@@ -167,7 +166,7 @@ There following are DebugMode exceptions you might encounter: ...@@ -167,7 +166,7 @@ There following are DebugMode exceptions you might encounter:
.. class:: BadDestroyMap .. class:: BadDestroyMap(DebugModeError)
This happens when an Op's ``perform()`` or ``c_code()`` modifies an input that it wasn't This happens when an Op's ``perform()`` or ``c_code()`` modifies an input that it wasn't
supposed to. If either the ``perform`` or ``c_code`` implementation of an Op supposed to. If either the ``perform`` or ``c_code`` implementation of an Op
...@@ -177,7 +176,7 @@ There following are DebugMode exceptions you might encounter: ...@@ -177,7 +176,7 @@ There following are DebugMode exceptions you might encounter:
For detailed documentation on the ``destroy_map`` attribute, see :ref:`inplace`. For detailed documentation on the ``destroy_map`` attribute, see :ref:`inplace`.
.. class:: BadViewMap .. class:: BadViewMap(DebugModeError)
This happens when an Op's perform() or c_code() creates an alias or alias-like This happens when an Op's perform() or c_code() creates an alias or alias-like
dependency between an input and an output... and it didn't warn the dependency between an input and an output... and it didn't warn the
...@@ -186,7 +185,7 @@ There following are DebugMode exceptions you might encounter: ...@@ -186,7 +185,7 @@ There following are DebugMode exceptions you might encounter:
For detailed documentation on the ``view_map`` attribute, see :ref:`views`. For detailed documentation on the ``view_map`` attribute, see :ref:`views`.
.. class:: StochasticOrder .. class:: StochasticOrder(DebugModeError)
This happens when an optimization does not perform the same graph operations This happens when an optimization does not perform the same graph operations
in the same order when run several times in a row. This can happen if any in the same order when run several times in a row. This can happen if any
...@@ -195,7 +194,7 @@ There following are DebugMode exceptions you might encounter: ...@@ -195,7 +194,7 @@ There following are DebugMode exceptions you might encounter:
whereby we debug in DEBUG_MODE and then run the full-size jobs in FAST_RUN. whereby we debug in DEBUG_MODE and then run the full-size jobs in FAST_RUN.
.. class:: InvalidValueError .. class:: InvalidValueError(DebugModeError)
This happens when some Op's ``perform`` or ``c_code`` implementation computes This happens when some Op's ``perform`` or ``c_code`` implementation computes
an output that is invalid with respect to the type of the corresponding output an output that is invalid with respect to the type of the corresponding output
......
...@@ -104,22 +104,22 @@ The first argument you pass is the `dtype` and the second is the ...@@ -104,22 +104,22 @@ The first argument you pass is the `dtype` and the second is the
Where `dtype` is one of (a complete list of supported dtypes): Where `dtype` is one of (a complete list of supported dtypes):
=========== ================ ================= ================= =================== =================
dtype domain bits dtype domain bits
=========== ================ ================= ================= =================== =================
int8 signed integer 8 ``'int8'`` signed integer 8
int16 signed integer 16 ``'int16'`` signed integer 16
int32 signed integer 32 ``'int32'`` signed integer 32
int64 signed integer 64 ``'int64'`` signed integer 64
uint8 unsigned integer 8 ``'uint8'`` unsigned integer 8
uint16 unsigned integer 16 ``'uint16'`` unsigned integer 16
uint32 unsigned integer 32 ``'uint32'`` unsigned integer 32
uint64 unsigned integer 64 ``'uint64'`` unsigned integer 64
float32 floating point 32 ``'float32'`` floating point 32
float64 floating point 64 ``'float64'`` floating point 64
complex64 complex 64 (two float32) ``'complex64'`` complex 64 (two float32)
complex128 complex 128 (two float64) ``'complex128'`` complex 128 (two float64)
=========== ================ ================= ================= =================== =================
The broadcastable pattern indicates both the number of dimensions and The broadcastable pattern indicates both the number of dimensions and
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论