Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 1.25 KB

debug.rst

File metadata and controls

47 lines (30 loc) · 1.25 KB

Debug mode

In debug mode, Chainer checks values of variables on runtime and shows more detailed error messages. It helps you to debug your programs. However, it requires some additional overhead time.

You can enable debug mode with chainer.using_config:

with chainer.using_config('debug', True):

...

See configuration for Chainer's configuration mechanism.

You can also set CHAINER_DEBUG environment variable to 1 to enable this mode.

In debug mode, Chainer checks all results of forward and backward computation, and if it finds a NaN value, it raises RuntimeError. Some functions and links also check validity of input values.

You can check if debug mode is enabled with chainer.is_debug function.

chainer.is_debug chainer.set_debug

Deprecated interface

As of v2.0.0, it is recommended to turn on the debug mode using chainer.config.debug. See configuration for the way to use the config object. We leave the reference of the conventional way (which has been available since Chainer v1) as follows.

chainer.DebugMode