Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 1.41 KB

debug.rst

File metadata and controls

46 lines (29 loc) · 1.41 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.

If you want to enable debug mode for the entire code, you can set CHAINER_DEBUG environment variable to 1.

You can also enable or disable debug mode for the specific scope of code with chainer.using_config or by changing chainer.config.debug configuration.

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

...

See configuration for the details of Chainer's configuration mechanism.

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 more strictly.

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